1) You can pay the loan before year end. If you did not, then, you need to pay the khoms, except if the debt was for something you need, and you still use it, like if you purchased a car for 20k, on installments basis, and by the end of the year you had 5k in hand, while your loan debt is 10k. In this case, you do not need to pay the khoms of the 5k.
2) You can wait till you get it back, and pay the khoms immediately.
3) You have to pay the khoms of each installment, before paying it.