When you agree a "time to pay" agreement with HMRC, a direct debit is set up to take the agreed monthly payments over the agreed number of months....but if you also have a direct debit set up to usually pay your VAT return liability, then that will still exist, in addition to any time to pay agreement direct debit.
Usually when you have a time to pay agreement, you are meant to cancel any other existing direct debits for VAT and then reinstate that direct debit once the time to pay is finished.
You need to call debt management
Payment problems and explain the problem.
HMRC should be able to credit the funds back to you under the direct debit guarantee, else speak to your bank because the direct debit guarantee matters and means if an error has been made, the funds will be pulled back from HMRC.
But speak with HMRC first, as regardless of who's fault this is, you had an agreement in place that has not been fulfilled properly. .