A journey planner will just spit out the shortest (timewise) journey it finds, if this cannot be done in 1 day you will get a long night time connection wherever the furthest it is possible to get in the first day.
Unless you are very keen on travelling through the night and waiting on (or outside) a deserted station I would suggest pausing your journey earlier in the evening, finding suitable accommodation and resuming at a reasonable time the next day.
What a train are you taking? There is no direct train between Paris and Chiasso. There are 3 TGV trains between Paris and Milan at the day via Modane.
In Switzerland Stations are in good shape and not so risky, but it is not so fine to wait.
Some station buildings are closed night time-for reasons anyone can think of.Its Swiss-though on border-so prices are sky-high, and labour is also very well paid, so no, do not epxect anything to be open all night.
But you must really have chosen a very weird connection to find this trip.
But hint/tip: IF you consider these trips-do remember you can use all trains-also via byways etc-in general airports are the best places to stay a few hrs nighttime-open, and many people arr, pretty early for the frist flite/day. But often sleeping is frowned on-or you may even then be expelled if they aski for bookings etc. There is even a dedicated site for that: sleepinginairports. In Swiss that would be Zürich.