Answer:
When the wire loops around the piece of steel, it creates an electromagnet. The magnetic field generated by the electromagnet interacts with the magnetic properties of the steel, causing it to become magnetized. The strength of the magnetic field depends on the number of loops of wire, the amount of current flowing through the wire, and the magnetic properties of the steel. When the battery is disconnected, the magnetic field collapses, and the steel loses its magnetization.