An iron needle is attracted to the ends of a bar magnet but not to the middle region of the magnet. Is the material making up the ends of a bare magnet different from that of the middle region?
No, the material making up the middle region of a magnet is the same as that of the material making up its end. When an iron needle is taken closer to one of the ends of a magnet, the pole of the magnet induces a pole of opposite polarity on the needle, making the needle a magnet itself and thereby making it attracted to that pole.
But if we bring the needle closer to the centre of the magnet, then both the poles of the magnet will induce opposite polarity on the needle. As a result, the needle will not get attracted towards the centre of the magnet.