Magnetic lines form continuous closed loops because magnetic monopoles do not exist in nature. We always find magnetic North and South pole, which are coupled together in such a way that the field lines originate from one pole and end at another pole.