Air does affect light,but not much,so it seems invisible.First reason is that the average air molecule is about 1 nm across,while light waves are on the order of 500 nm across. Hence,light continues its way not being affected.Another reason is that atoms are widely spaced where light pass through, since it has a small chance of interacting with air .However,if there is a lot of air,light can affect molecules in a phenomenon called “scattering “ later we will discuss it in the question ‘Why is the sky blue ?’
The Earth has its own magnetic field , it acts like there is huge bar magnet buried inside,but this bar magnet is not on the earth rotational axis it is shifted by some angle.The south of the bar magnet is on the magnetic north and the south polarity is on the magnetic north(image).As opposite polarities attract the magnetic needle (north) is attracted to the south polarity in the magnetic north.That’s why the needle always points north.If you want to know “why earth has magnetic field?”go to letter E.