There are no direct trains from Edinburgh Airport to York.
You also don't have to go to Waverly station. Haymarket is a much smaller station near Waverly and the airport tram stops right in front of it. Just make sure that the train you want to take is direct from Haymarket to York (no changes).
You can still go to Waverly but Haymarket is less walking with your luggage.
Be aware, if you buy the cheapest ticket (Advanced) and you miss the train due to a delay in your flight, you lose the ticket. Buying an "Anytime" ticket means you can take any train that day.
Use this official website to look at schedules:
http://www.nationalrail.co.uk
By the way, Rome2rio is not always correct.