Answer
$W = -25.30\ kJ$
Work Step by Step
For the initial state, saturated at 0.5 MPa, with 30% quality:
From steam tables:
$T_1 = 151.83°C,\ v_{1,L} = 0.001093\ m³/kg,\ v_{1,G} = 0.37483\ m³/kg$
$v_1 = v_{1,L} + x(v_{1,G} -v_{1,L} )= 0.11321\ m³/kg$
For the second state, saturated liquid at 100°C:
$P_2 = 101.42\ kPa,\ v_2 = 0.001043\ m³/kg$
With the linear change in pressure and volume to to the spring, the work is area under the trapezoid:
$W = m(v_2-v_1)(\frac{P_1+P_2}{2})$
$W = -25.30\ kJ$