By heating a gas inside a cylinder, you allow it to expand against a piston while maintaining a constant temperature. The energy that you add as heat goes into the PV work of the gas against the piston. To start again, you have to push the piston back to the start point, compress the gas. My book says that "we must cool the gas first before it can be compressed to its original state with less work than was gained" Why must the gas be cooled first? It's slightly confusing..