But, according to the 2n2 rule, the M-shell can hold upto 18 e-. So, doesn't this mean that the e- configuration of Ca can also be written as 2,8,9,1 or say, 2,8,7,3 or something?
Experimentally, the ground state electron configuration is 2, 8, 8, 2, so there is no other correct way to write it. 2,8,9,1 and 2,8,7,3 would be incorrect.
Really the only way to know is through experiment or possibly very high level calculations that include relativity and quantum electrodynamics. As atomic number increases, the problem becomes more and more complex. It isn't necessarily true that one configuration accurately describes the ground state.
For example for Lawrencium (element 103), for which no experimental determination has been made, you will see some periodic tables that say it has a 7p electron (8 electrons in the P shell and 3 electrons in the Q shell) and some that say it has a 6d electron (9 electrons in the P shell and 2 electrons in the Q shell).
See The low-lying level structure of atomic lawrencium (Z=103): energies and absorption rates to appreciate how difficult it is to really calculate such information.