How does lending money contribute to society? I essentially asked this question here, but IMO didn't get an answer from anyone who knew what they were talking about.

Normally someone gets paid because they work in a job, i.e. they contribute to society. I get paid by lending money to other people and charging interest. What exactly am I being paid for? It doesn't feel that I'm doing anything to better society.

It enables them to buy things they otherwise couldn't afford... in the near term. But ultimately they have to pay back the debt plus interest, so they can actually afford less in the long term. Is it just that I'm being paid to satisfy people's impatient desires? It doesn't seem that I'm contributing to long-term economic growth, and it seems that I may even be hurting it.

Someone suggested that the loans can be used to finance investment, so I thought about it for a while. I considered an economy consisting of three agents: BANK, person A, and person B.

Suppose person A is destitute and BANK lends £100 to person A in exchange for £110 later. Then person A pays person B the £100 to build a factory. Then person A manufactures goods with the factory and sells them to person B for £150. It seems that BANK has made £10 for nothing, as person A and person B could have come to an arrangement where person B would build the factory + pay person A £50 in exchange for the goods manufactured by person A directly. Maybe it's different with more than three agents. But I still come to the conclusion that the agents could collectively come to an agreement that wouldn't involve the BANK "middleman". Maybe that wouldn't work in practice. But in any case, it doesn't feel that lending money does anything to contribute to society.
In this simplified hypothetical world, yes, person B could give 100 currency to person A to build the factory directly. But what if person B does not want to take on that risk? How does person B know that person A will be contracted to make 150 worth of goods properly? Person B could just wait to see if someone else finances person A and then buy from A if the factory is successful. A single individual lending, or even small businesses lending out money can be a relatively large amount of money for that entity (so, high risk), whereas banks are able to diversify risks, by making many different loans and spending time evaluating how risky different people are.

Banks take on risk that other people/firms can't afford to or don't want to. Interest rate is very roughly, the price needed to be willing to take on these risks, or more precisely, the rental rate of money.