First of all welcome ^^
What you're computer is doing, when generating, is trying to find a hash matching certain criterias. It's basically a
proof-of-work which is hard to do at first, but easy to check for everyone once you finished.
Think of it this way: it's a lottery, and the winner will be the one that first finishes his work. He'll be the one taking all the transactions, checking them and if it all seems right he'll use his newly gained authority (lottery winner) to sign them off as accepted.
He'll be the authority checking that no one is double spending in the network for the past ~10 minutes. For his work he'll earn the blocks 50 Bitcoins as a reward.
The whole proof-of-work scheme is used to have a single authority that decides what transactions are valid, and which aren't, and having completed the proof of work all others will accept the decision. Also it is used to distribute the initial Bitcoins among all users, and not have Satoshi sell them (single point of failure).