I have a doubt,,In a compass, the north pole always points towardsnthe north direction but how in the magnetic field lines it pointsntowards the south pole
We know like poles repel each other and unlike poles attract. The north pole of the compass points towards the geographic north pole. Refer to the diagram below and notice that at geographic north lies the magnetic south pole, so the direction of the field is towards geographic north pole and thus the needle aligns according to field of the earth.
Similarly, when you place the needle near a magnet the north pole of the needle will point towards the south pole of the magnet. That is it aligns itself according to the direction of the magnetic field line of the magnet.