A wire is wound around a card board tube to form what is called a solenoid. Leave the ends of the wire so that, they can be connected to a source of power such as a battery in an electrical circuit.
The material to be magnetized is placed in the solenoid and the current is switched on for a short time. The needle is then taken out and some pins are brought close to it.
The pins become attracted to the needle for some time.
This shows that the needle becomes magnetized so, the pins were attracted.
Magnets can also be made using electricity.