How do transactions fit into mining?
The transactions are already there when you are mining. You are hashing the block header which contains a merkle tree root that connects the list of transactions and block header together.

After you hash a valid block header you can't add any transactions as it would change the merkle root and the hash would not be below the current target anymore, so the block becomes invalid. This is also the reason why you can't mine in a pool and take the coins yourself if you find a valid block. That would require changing the generation transaction, which changes the merkle root, and the block is then invalid.

Mining is both about generating new coins (they must come from somewhere) and processing transactions (we need a ledger that everyone can agree is the one true ledger).