Heloc the sell to avoid taxes?

Quick question. I have a multi that I have decided to sell and I plan on using the proceeds to use as a down payment on a primary.

The multi has about 250k worth of equity w/ a 100k loan balance. Could I take out a heloc on the property to withdraw a bulk of the equity prior to selling therefore reducing capital gains tax once it’s sold because I’d have to use the proceeds to pay off initial loan and heloc?