I see late train out of Edinburgh to London stops in York at mid nite then resumes at 4am. Are passengers expected to exit train for this time period or can they sleep on train?
Although I can't see train numbers assigned, these are likely to be separate trains and you must get off. There is a direct overnight train with sleeping cars; see http://sleeper.scot .
I do not see this on the timetables website so I think you may be misunderstanding. A train simply would not do this.
I agree with the above. Trains don't just stop and sit in stations for 4 hours.
What website are you looking at this on?
I would use the website of the company running these trains: https://www.lner.co.uk/
I did a lookup for a random night on that site and got the following:
21:00 Depart Edinburgh, 00:14 Arrive York
Change at York 04h 26m
04:40 Depart York, 07:01 Arrive London Kings Cross
Two different trains, you will be sitting in the waiting room at York for 4 hours.
The next train after that is the Caledonian Sleeper. That is a through train, and it has beds you can sleep in (beds cost extra):
23:40 Depart Edinburgh, 07:07 Arrive London Euston
Website for the Caledonian Sleeper here: https://www.sleeper.scot/
No you cannot stay on the train. It will go into the depot for cleaning and servicing.
You cannot wait in the waiting room. From the official website:
Waiting rooms opening hours Monday - Sunday 06:00 - 22:00
You have to leave and return. The staff won't let you sit on the platform or in the concourse.
There are hotels nearby.