The magnetic field made by a single wire is not usually very strong. To make an electromagnet normally the wire is wrapped in many loops to make the fields of each piece of wire add together into one stronger magnetic field.