Gradually you pay off the mortgage (very gradually) so the rising value of the house, and the decreasing amount you owe on the mortgage, give you more equity in the house.
You can use this equity to put more equity into another house.
Also buying and selling at the right time can help.
House prices go up and down, and you get sellers markets and buyers markets.
Buy when house prices are low, and in a buyers market where you can knock down the price of the house you want to buy.
Buying at the moment is a bad time as house prices are (or were) rising and it is a sellers market (though that is gradually changing).
It is possible to "make money" with house buying but you have to buy and sell houses at the right time, and be prepared to "do up" houses so you can sell it for more than you paid for it.
But it is quite an art.
Watch "houses under the hammer" on TV for how it is done.