A heat engine is a device that converts heat into mechanical motion that can be used to do work .
In general an engine converts energy to mechanical work .