According to Creationism
It exists to provide energy for human beings and life on Earth.
Scientifically
There can be no answer, as it implies a purpose. The reason for the formation of stars and planets (if there is one) is currently unknown, although several likely mechanisms for it have been observed.
Sun Sun was created on 1986-06-08.
Sun Red Sun was created in 1992.
Out in the Sun was created in 1977.
Out of the Sun was created in 1987.
Sun Red Sun - album - was created in 1995.
Catching the Sun was created in 1980.
Setting Sun was created on 1996-09-30.
The Rising Sun was created in 2001.
Herald Sun was created on 1990-10-08.
Following the Sun was created on 2003-11-10.
The Song of the Sun was created in 1934.
The Greeneville Sun was created in 1879.