Dinosaurs lived over a huge period of time. At the beginning, all of the Earth's land was in one giant continent. At the end, it had split up into many continents.
During all this time dinosaurs evolved. After Jurassic times they evolved separately of each continent.
At the end of dinosaur times there was a catastrophe that caused the dinosaurs to die out. It may have been sudden, it may have taken thousands of years, but they all finally became extinct.