Draw a free body diagram.
The rope has to provide force to hold the weight, and to provide acceleartion.
Now the mass in each equation is the mass that rope is pulling. For the top rope, both masses. For the bottom, one mass.
The net force exerted on the block must be m a, where a is the acceleration. If we choose the upward direction to be positive, we have:
m a = -mg + F_rope
where F_rope is the force exerted by the rope in the upward direction. This means that:
F_rope = m (g+a)
F_rope is also the tension in the rope. The definition of tension is as follows. If you consider a rope, you can take some arbitrary point in the rope. Then, you can ask how hard is the part of the rope above this point pulling on the part of the rope below this point.
Now, F_rope is the force that the rope is exerting on the block. So, by action equals minus reaction, this means that the block is exerting a force of minus F_rope on the rope.
Then focus on the part of the rope from the block to the chosen point p in the rope. If the part above point p pulls with force F_p, then the total force exerted on the rope below point p is:
F = F_p - F_rope - m_p g
where m_p is hte mas of the part of the rope. This must be equal to the acceleraton of the rope of a = 2 m/s^2 times m_p:
F_p - F_rope - m_p g = m_p a ----->
F_p = F_rope + m_p(a+g)
Now, if the mass of the rope is very small we can ignore the last term. Then we have:
F_p = F_rope
So, at any point in the rope, the part of the rope above the point exerts a force of F_rope to the part below the rope.