I appreciate you for getting back to us here in the Community, @DiaA1.
Let me share some clarification about the payment in QuickBooks Online.
The detailed steps provided above is the normal process of how to record the loan and payments to reduce liability. However, to offset the invoice payment against the loan, you'll need the advice of an accountant.
One of them will be able to assist you further with the best account to use to reduce the liability correctly. Also, please know that we can't suggest which account you should select in this type of situation.
Additionally, I recommend the following resource about creating a journal entry: Create a journal entry in QuickBooks Online.
Please know that I'm just a post away if you have any other questions. Have a great day ahead.