In Newton's Third law of motion, the 'action' and 'reaction' forces act on different objects. That's why they don't cancel each other out and always result in zero force.
Given there are three blocks of masses , and (ref image in attachment)
When all three masses move together at an acceleration a, the force F is given by
F = ( + + ) *a ................(equation 1)
Also it is given that does not move with respect to , which gives tension T is exerted on pulley by only, Hence tension T is
T = *a ..........(equation 2)
There is also also tension exerted by . There are two components here: horizontal due to acceleration a and vertical component due to gravity g. Thus tension is given by
T = ................(equation 3)
From equation 2 and 3, we get
*a =
Squaring both sides we get
* = * (+)
* = ( * )+ ( *)
( - ) * = *
= */( - )
Taking square root on both sides, we get acceleration a
a = *g/()
Hence substituting the value of a in equation 1, we get