Sending the letter, and lending them the brolly, is something that they could have done, but they didn't.
With the first sentence: If the person has not yet gone out, the lender would say "I could lend you the brolly" (so you don't get wet).
As the person had already gone out, and returned (I assume wet), the lender said "I could have lent you the brolly", indicating they were willing to lend it to the person before they went out.
I hope this is clear enough...