My electromagnet doesn't work?

I have to make an electromagnet, and the limits set by my teacher is - a single D battery, and max number of coils of the wire = 50. The only thing we can choose on our own is the core. My setup - A rebar, a non-insulated gauge 12copper wire coiled 38 times(didn't have enough of it) and the D battery. When I... show more I have to make an electromagnet, and the limits set by my teacher is - a single D battery, and max number of coils of the wire = 50. The only thing we can choose on our own is the core.

My setup - A rebar, a non-insulated gauge 12copper wire coiled 38 times(didn't have enough of it) and the D battery. When I connect the two ends of the wire to the battery, the tips of the wire get really hot but it barely works as a magnet.

I researched and found out that what I was doing was shorting the wire, but how do you not do that? I can buy more copper.
11 answers 11