Contact Apple about that. Normally refunds are made to the payment method used, which cannot possibly be account balance if this was a gift card purchase. If Apple cannot find the original method used, the bank can usually adjust things so a replacement method is credited. If the bank cannot find a way to credit you (e.g., you closed your account) then Apple at that stage may deposit the refund in your personal balance.
When you call Apple, make sure that you explain fully what has happened. Account balance cannot normally be refunded to a bank account, but if this was an error as you describe then make sure Apple understands what has happened.
Refer to this page for Apple Support features ➔ Contact - Official Apple Support
Select from the presented options until you find a solution for your issue, or see if there is a chat or phone call contact method offered lower on the page under “Get more help” (you sometimes have to narrow down the options multiple times before this is shown). If you do not see your issue, keep experimenting with any series of selections until you reach one that offers a chat session or a telephone call and get the representative to redirect you.
This support article has various country telephone numbers for contacting Apple for support and service ➔ Contact Apple Support - Apple Support For some countries look under “Other” listing at the end of the list. Not every country has telephone support, and phone numbers may only work when calling from the same country.