I think the biggest hurdle at the moment is proper (documentation of) tagging of the routes. I’m finding some routes in France tagged with by_night=only and sleeping=yes. The latter is not necessary per se to be a night train, I know there are some trains in Germany that do run at night but are not sleeper trains. It depends on your requirements.
https://wiki.openstreetmap.org/wiki/Tag:route%3Dtrain needs to be extended to document more of the tags that are already used. An effective overpass query can only exist when the relations can be found via their tagging.
I’m not very experienced with overpass, but when the tagging is correct, I think the query to get the proper lines is not so difficult.
"With Train Map, the position of the trains on the Belgian railway network can now be tracked live. The aim is to inform passengers better, says the NMBS that launched the application today. "