I'm not an accountant, but I believe that no, you can't do that! If you sell the IP, you would be expected to pay down the loan with the proceeds. If, however, you sold it & the proceeds didn't cover the entire loss, then I believe the remainder would be deductable.