For most of the star's life, a star shines and produces light due to thermonuclear fusion of hydrogen into helium in its core, releasing energy that traverses the star's interior and then projects into outer space.
Solar generation is a safe alternative which can replace current fossil fuels like coal and gas for generation of electricity that produce air, water, and land pollution. That solar generation does not.
With coal and gas generation, forests are destroyed for mining raw materials like fossil or nuclear fuels. Trees are constantly removed, they use carbon dioxide from the air to make their food, and this carbon is then stored in them. So when burned, all of this carbon dioxide is released.