That's what happens when we don't follow the basic rules of gambling. But I think you have learnt your lesson.
Most of us have faced this because of the uncontrollable urge to recover the money we lost in the previous bets.
Thus we end up using all our money to recover the amount we used since the start of gambling.
But it's better to limit our losses for the day and come back another day if we are losing a lot on a particular day.
Controlling the emotions is where many fail and hence lose all their money.
The best lesson that will really sink is the one that will hurt us in OP's case, it's his pocket and of course, his motivation because he needs to work hard to pay the debt and the interest, this is money that you can't afford to lose, this is the kind of situation where no gamblers want to be in, it's ok if it's your own money but this is not your money and it is incurring interest.
He needs to try working overtime or to find additional sources of income to pay that debt/loan that he mistakenly losses
while he was doing his gambling activities, there' nothing he can do now but to learn from that mistake and try not to allow
that to happened again, there are many people who also encounter same mistake, those who are not ready with how single
mistake can ruined your finances.