getting around taxes

So I have had this idea for a while now and am curious about whether it is possible/legal. These numbers are not exact, but just an example of the plan.

Start with 100k

buy a house for 70k put 30k in work, sell for 150k. End profit of 50k.

Use a 1031 exchange to reinvest the profit in a new house.

Buy a new house for 120k. put 30k in work. Sell for 200k when all said and done.

Do this over and over (slowly taking out the 100k to live off of). Eventually end up with say 1 million.

Could I take the 1 million and invest it again into an apartment/commercial building and then just receive rent? Am I correct that I wouldnt have to pay capital gains on the million until I sold the actual building?

Thanks

It is my understanding that you can’t use a flip property for a 1031…it is inventory to your business.

If you fixed up the property and rented it out for a while then you could do a 1031 to another and another and then another.

Keith