Praise be to Allah.
Firstly: It is not permissible to make accounts for gamblers
It is not permissible to make accounts for gamblers, because that comes under the heading of helping in sin and transgression, and Allah, may He be exalted, says (interpretation of the meaning): “And cooperate in righteousness and piety, but do not cooperate in sin and transgression. And fear Allah; indeed, Allah is severe in penalty” [al-Maa’idah 5:2].
And the Prophet (blessings and peace of Allah be upon him) said: “Whoever calls people to guidance will have a reward like that of those who follow him, without that detracting from their reward in the slightest. And whoever calls people to misguidance will have a burden of sin like that of those who follow him, without that detracting from their burden of sin in the slightest.” Narrated by Muslim (4831).
The money that resulted from this work is haraam, because it is in return for an unlawful benefit.
Secondly: What should a person do who hired someone to do haraam work then he repented?
We have previously noted in the answers to questions no. 303583 and 102217 that if a person hires someone to do haraam work then he repents, he should not pay that worker his wages; rather he should give that money in charity. The same applies to someone who buys something that is haraam, such as wine; he should not give its price to the seller; rather he should give it in charity, because it is wealth that is given in return for an item or benefit that is unlawful.
Ruling on one who borrows or transgresses against wealth that is haraam because of the manner in which it is acquired
With regard to someone who borrows or transgresses against wealth that is haraam because of the manner in which it is acquired, then what appears to be the case is that he must return it, and the sin of acquiring it is on the one who acquired it.
Your taking some of your friend’s wealth without his permission is a kind of transgression, which comes under the rulings on usurping wealth. Therefore you must return the money to him, and advise him to give up what is haraam.
But does your friend have to get rid of this wealth? That is subject to further details:
1.. With regard to whatever he took before he came to know that it is haraam, it is permissible for him to make use of it.
2.. With regard to whatever he took after he came to know that it is haraam, he must get rid of it by giving it to the poor and needy, or spending it on public interests, unless he needs it, in which case he may take as much of it as he needs.
Shaykh al-Islam said: If this prostitute and wine seller have repented, and they are poor, it is permissible for some of this wealth to be given to them, commensurate with their need. If he is able to do business or practice a craft such as weaving and spinning, he may be given capital from that wealth [to set up in trade], but if they borrow some of that money in order to start earning a living, that is better.
End quote from Majmoo‘ al-Fataawa (29/308).
See also the answer to question no. 78289 .
And Allah knows best.