please explain this sentence - the direction of magnetic field is taken to be the direction in which a north pole of the compass needle moves inside it .
The direction of magnetic field lines can be traced out with the help of a compass needle. Suppose, we place a compass needle near to the north pole of a bar magnet. As like poles repel each other and unlike poles attract each other, the north pole of the compass needle will point away from the north pole and point towards the south pole. From this we observe that the magnetic field lines originate from the north pole and terminate at the south pole.
So whenever you place a compass needle, the north pole of the needle gives you the direction of the magnetic field.