Hi userimripersiado!
I can share two ways on how to record the security deposit and the return of the funds. However, it's best to reach out to your accountant so they can guide you on how to properly enter them in QuickBooks Online.
The first one is by recording the security deposit using a bank deposit, the same as what you did. But the affecting account should be an Accounts Receivable (A/R). Then, you can create a check affecting the A/R to record the return of the security deposit. You can go back to your deposit and correct the details.
Another way is to record the deposit as a liability. Then, you can use it to pay back your tenant using an expense transaction. For the detailed steps, please check this link: Record a retainer or deposit. Proceed to the Pay customer expenses with money held in the liability account section.
Leave a comment below if you need more help. We'll respond as soon as we can.