Let's say on your books Long Term Debt has a $200,000 balance. Then you find that's wrong and should be $180,000 so you actually pay $180,000. You then DR LT Debt for $180K and CR Cash $180K. Now, LT Debt still has a balance of $20K Credit.
So you need to DR LT Debt for $20K and offset (post a CR to a revenue acct) to P&L. Use an Acct like "Miscellaneous Income" for the $20K credit. It is the correction of an error that happened somewhere during the life of the debt. But anyway do NOT adjust retained earnings directly.