Get your taxes done using TurboTax

No I didn't say that.  Loans don't figure into the sale or cost at all.  It is simple the Sales Price minus your original cost plus any improvements to the property.   The original mortgage or loans or refi's don't count.