Deductions & credits

You have two separate issues.

 

First, a refund of a prior tax deduction or prior tax-free reimbursement is a "Taxable recovery."  You list it as taxable income under "other uncommon income."  It's taxable income now, because it was tax-free before but you're getting reimbursed.

 

You can't put the money back in the HSA as a "return of mistaken distribution" because the issue happened over several years.  And in fact, there was no need for you to put the money back in the HSA, once you pay tax on the recovery, it's yours to do whatever you want with it.  

 

(Note, if the payment was in 2022, for a distribution you took only in 2022, it could have been reversed.  But this spanned several years so that is not an option.)

 

Then secondly, you did make a contribution to the HSA, because it is not allowed to be treated as a return under these circumstances.  Assuming you are eligible to make a contribution and your total contributions are less than your annual maximum, you just enter the contribution in the normal way and take the tax deduction. In Turbotax, your payroll contributions are on your W-2 and detected automatically, you can enter additional contributions on the HSA section of the Deductions and Credits page.  Only list additional contributions, don't list the payroll deductions again.