The magnetic field lines of a bar magnet can be mapped using a magnetic compass. The compass can be moved from one pole of the bar magnet to another and we can trace the field lines by moving the compass gradually and drawing the corresponding line which the compass would trace while following a particular line of force.
Another method is to take a paper and place the bar magnet below the paper and sprinkle iron powder or tiny iron pieces on the paper. The iron particles will align and position themselves according to the magnetic field lines. Thus, we can evaluate the magnetic field lines of the bar magnet.
electric charges in motion produce magnetic fields and moving magnets
generate electricity.