Thousands of people lined up along the route of a hearse carrying the queen's coffin from Balmoral to the Scottish capital of Edinburgh.