The best description of how to build an electromagnet is:
Attach a wire to one end of a battery, wrap the wire around an iron or steel core, and attach the other end of the wire to the other end of the battery.
This method creates a loop of wire around the core, which generates a magnetic field when electrical current flows through the wire, enhancing the magnetism of the iron or steel core.