After they went shopping, they left Diagon Alley (and the Wizarding World) via wall behind the Leaky Cauldron and then back into the Muggle world.
The late-afternoon sun hung low in the sky as Harry and Hagrid made their way back down Diagon Alley, back through the wall, back through the Leaky Cauldron, now empty.
Harry Potter and the Philosopher's Stone - — CHAPTER FIVE — Diagon Alley
They traveled by Underground from the Cauldron to Paddington where Harry caught a train back to Little Whinging. In the film this journey is omitted but we do see them in the Cauldron, when Harry learns about his parent's fate at the hands of Voldemort.
Harry didn’t speak at all as they walked down the road; he didn’t even notice how much people were gawping at them on the Underground, laden as they were with all their funny-shaped packages, with the sleeping snowy owl on Harry’s lap. Up another escalator, out into Paddington station; Harry only realised where they were when Hagrid tapped him on the shoulder.
Harry Potter and the Philosopher's Stone - — CHAPTER FIVE — Diagon Alley
Several weeks later Harry then traveled from Little Whinging to Kings Cross (meeting the Weasleys) where he then returned to the Wizard World via the gate at Platform 9 3/4