The mechanical energy is caused by the attractive force of the electromagnet ... Using this device, you could make the nail move in a circular pattern.) ...
A simple electromagnet is made by coiling wire around an iron nail. An iron core makes a temporary electromagnet. It loses its magnetism as soon as the switch is opened and the current is switched ...