Get your taxes done using TurboTax

Loans don't affect the gain on the sale. Just sales price - cost+improvements.   What you do with the proceeds don't matter either.