It’s not a proper overnight train. Look closely and you’ll see there’s a change of trains. It’s a late train from Glasgow that deposits you in Edinburgh, where you have to wait for five hours or more in the middle of the night to catch an early morning train to York. The thing that slows you down is getting off the first train and twiddling your thumbs for hours while waiting for the next train. No couchette - just you in s deserted station trying to get comfortable on s bench or walking the streets for a while.
Always look carefully for the number of changes. You can usually click to expand for journey details, which will give you exactly what trains you’re catching. Looking at the service that you mention, you’ll get to Edinburgh around half-past midnight by which time all the trains to York havd finished for the night - so the website finds you the next available train to York, which leaves at 5.48am.
There aren’t many long-distance overnight trains in the UK. There’s the Caledonian sleeper that runs down to London but doesn’t help you from Glasgow to York, and there’s a train that runs between London and Cornwall.
Otherwise any service that looks like an overnight train is bound to involve some kind of long cold wait in an empty station, or loads of changes.