Joe Dear Joe, Volcanoes are a natural way that the Earth and other planets have of cooling off.
Planets are warm in their mantles.
Heat inside planets escapes towards their surfaces. For reasons that are not well understood, heat sometimes melts rocks, which then rise bouyantly toward the planet's surface. Some volcanoes erupt for only a short time - a few days to weeks and never erupt again. Large volcanoes such as stratovolcanoes and shields erupt many thousands of times throughout their lifetimes of hundreds of thousands to a few million years. I notice from your email address that you are at the University of California at Santa Barbara.