when you will put a weight on a string the string will become taut
and there willl be an internal tension force setup in the wire
at the point of contact of the string with mass1 since the rope is massless no matter what the accelaration of the point be the net force on it
F = M * A = 0 because M = 0
so net resultant force at the point of contact is zero
therefore the tension force is always opposite to the applied force
as far as the magnitude of tension force is concerned it will be equal to the external applied force
now you must be wondering that there are 2 different external forces acting on the rope so what will be the tension force
see the answer to this is that on the either side of the pulley tension forces of difeernet magnitude will be acting and this will be responsible for the rotation of the pulley