All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
If the loan was free of Riba (interest and/or usury), then you and the moneylender both did a good act and Allaah will reward both of you. However, if the loan involved Riba (i.e. if it was an interest-based loan) then it is pure Riba and forbidden, and taking it for a friend does not make it lawful. The Prophet said: “Allaah has cursed the one who consumes Riba (i.e. usury or interest), the one who gives it to others, the one who records it and the one who witnesses it (its transaction).” He said: “All of them are equal in sin.” [Muslim]
Now, you have to sincerely repent to Allaah, give the amount back without any interest if you can do so; otherwise, you pay back the amount with the interest and it is the moneylender who would be held accountable for that.
We inform those who take interest-based loans that there are many lawful substitutes for that. For instance, one may establish cooperative and charity committees, take interest free loans from rich people, or purchase something by loan and then sell it to other than the seller to get cash, etc.
Allaah Knows best.