Dear Student
Exchange if energy takes place from a gas to the environment when temperature of both are different or work is done.
When exchange of energy takes place from a gas to the environment that is energy is transferred via heat to the surroundings then temperature of gas decreases and that of environment increases.
When heat is removed from a system the heat cools down. If you condense steam then it will become liquid water.
Regards