Your attempt is correct. Your method works because the tensions in the ropes are internal forces, and the sum of work done by internal forces is zero. Work done by one part of the system is work done on another part of the system. "The system" here consists of the 3 masses and the moving pulley.
This gives you the equation of constraint :
(The same relation could be obtained by considering what happens to C if A and B move up by $x_A$ and $x_B$ respectively.)
From the above we get the relation between accelerations :
To get more equations, so that we can solve for the accelerations, we have to consider external forces - eg the pull of gravity.
An important observation (which I overlooked) is that blocks B and C are initially at rest on a floor and cannot move downwards.
The weight of A+B > C, so C will accelerate upwards and the "free" pulley on the LHS will accelerate downwards. Since the system starts from rest the direction of acceleration is also the direction of velocity - ie motion.
So either A or B (or both) will move downwards. Since the weight of B > A then B would move down - if it were not prevented by the floor. So it must be that A moves down while B rests on the floor $(a_B=0)$. Applying the restraint equation this leaves $a_A=-2a_C$.
Apply $F=ma$ to blocks A and C - remember that +ve acceleration is upwards :
Eliminating $T$ we get