why do atoms need to be ionised in a mass spectrometer?
why do atoms need to be ionized in a mass spectrometer? why can't you determine the mass of the atoms when they are not ionised?


There are various types of mass spectrometer
https://en.wikipedia.org/wiki/Mass_spectrometry#Mass_selection
but all of them require neutral particles to be charged in order to be accelerated and then detected. The spectrometers use electromagnetic fields to accelerate the ions, this effect only occurs if the species are charged as the field will not accelerate a neutral particle. 

For example, in the magnetic sector machine, the ions are formed in an ionization chamber, accelerated in a uniform electric field and shot into the magnetic sector where they are sorted by their path through the field. The higher the charge on the particle, the more it is defected, the higher the mass, the less it is deflected:

http://orgchemguide.blogspot.com/2011/04/magnetic-deflection-or-sector-mass.html


  Also what is the mass-to-charge ratio


So the ions are sorted not by their charge or mass alone, but by the ratio of the two, the mass to charge ratio. The machine cannot tell the difference between an ion with mass 4 amu and charge 1+ and another with mass 8 amu and charge 2+, both have the same mass to charge ratio and will behave identically in the field.

Most detectors also work only if they are struck by a charged particle.

Here is a great guide to the simple principles of how a MS works:
https://www.chemguide.co.uk/analysis/masspec/howitworks.html