This transaction comes under the heading of tawarruq using shares [tawarruq means buying an item to be paid for at a later date, then selling it – to someone other than the person from whom one bought it – for cash, usually at a lower price], and calling it a loan is clearly incorrect. This is why you felt uneasy about it, because if it were a loan, it would not be permissible to pay more than you take.
We have previously discussed tawarruq using shares and the conditions of its being permissible in detail, in the answer to question no. 118270.
If the conditions of permissibility are met in this transaction, then there is nothing wrong with you getting involved in it in order to do an act of kindness to your brother. So long as the transaction is in your name, your giving the money to your brother is by way of a loan. So if you buy the shares from the bank for 100,000 – for example – and you sell them for 90,000, you are lending 90,000 to your brother, and he is taking responsibility for the remaining ten thousand that belonged to the bank, which you had to pay because of him. If the lender is doing a favour to the borrower, he should not be penalised for that. “No ground (of complaint) can there be against the Muhsinoon (good-doers)” [al-Tawbah 9:91]. This is not regarded as a loan that brings a benefit, because in fact it does not bring you any benefit except in the Hereafter, in sha Allah. Concerning the reward for giving a loan, the Prophet (blessings and peace of Allah be upon him) said: “There is no Muslim who lends something to another Muslim twice, but it will be like giving charity once.” Narrated by Ibn Maajah (2430); by Ibn Hibbaan in his Saheeh; and by al-Bayhaqi in a marfoo‘ mawqoof report. Classes as hasan by al-Albaani in Irwa’ al-Ghaleel, 5/225
And Allah knows best.