A heat engine is a device that converts work into heat?

No, a heat engine is not a device that converts work into heat. It is the opposite, which means it is a device that converts heat into work.