What does bitcoin mining do

Bitcoins are discovered rather than printed. Computers around the world “mine” for coins by competing what does bitcoin mining do each other. How Can I Buy Bitcoin?