Question: how to buy a new home before you sell your old one?
Answer: Make a contingent offer.
Secure cash to make an all-cash offer: Borrow against 401K, get a bridge loan, home equity line of credit, or alternative options.