The lines are curved towards both ends of the magnet because the magnetic field is strongest at both ends,i.e north and south poles.As an object goes farther away from the poles,the magnetic force over it becomes weaker and weaker.
Did you know that the magnetic field of a magnet is not uniform? The strength of the field varies depending on its location around the magnet. The magnetic field of a bar magnet is strongest at either pole of the magnet. It is equally strong at the north pole when compared with the south pole. The force is weaker in the middle of the magnet and halfway between the pole and the center.
If you were to sprinkle iron filings on piece of paper and place the magnet beneath it, you could see the path of the magnetic field lines. The field lines are closely packed at either pole of the magnet, widening as they get further from the pole and connecting to the opposite pole of the magnet. The magnetic field lines emerge from the north pole and enter the south pole. The magnetic field gets weaker the further you get from either pole, so a bar magnet is only useful for picking up small items over short distances.
Why the Magnetic Force Is Strongest at the North and South Poles
Iron filings make a pattern tracing field lines because each bit of iron is itself a tiny dipole. The force the dipole experiences is proportional to the strength of the dipole and the rate at which the magnetic field changes. The dipole tries to align itself with a magnetic field, but at the ends of a bar magnet, the field lines are very close together. What this indicates is that the magnetic field varies strongly over a short distance compared to the variation closer to the middle of the magnet. Because the magnetic field changes so dramatically, a dipole feels more force.