The initial pressure above atmospheric pressure (50bar, +15C), and therefore, the liquid phase is.
The piston performs a reciprocating motion, the piston may be connected to the flywheel through a curvilinear rod mechanism, not shown in the figure.
It is possible to implement a heat exchange with the environment.
You are not mistaken, it should be a perpetual motion machine of the second kind. This engine, which performs the work at the expense of the internal energy the environment or due its self-cooling.
I think that you understand the job right.