How to handle possible refunds from filing previous years tax returns?

The situation is that I'm currently working on preparing and filing tax returns for 2016, 2017 & 2018. I also currently have tax liabilities from earlier years filings.

 

So when preparing the tax filing for 2016 and if it shows that I should be getting refund from both a federal and state, do I then enter those refund amounts when I prepare my tax filing for 2017 tax returns? Also, My understanding is that I would not actually be getting the refunds as both federal and state would use it towards my previous tax liabilities. But I need to know how to handle those calculated refunds for tax files of subsequent year. I believe I will have the same situation when I prepare tax returns for 2017 and expect a refund (that will probably be withheld to pay existing tax liabilities, but how I would handle the "refund" amounts on the 2018 tax return.

 

Thanks in advance for any help/advice.