No, your analogy is not the same as buying a non-dividend-paying stock.
A better analogy would be you buy 50% of a house where the profits all go in a bank account that you "own" half of but can't withdraw from (and neither can the other owner). All you can do is sell your ownership to someone else or wait until the money eventually does get distributed. If the other owner wants to withdraw some, the disbursement has to split in proportion to the ownership (i.e. you get half and they get half).
If I don't pay dividend to my shareholders then I couldn't get money from the profit?
So let's separate the house (business) from the owners (shareholders). The other owner is also a shareholder, and so any distribution to shareholders have to to in proportion to the ownership. So if the other person wanted to take money out of the house, they'd have to distribute some to you.
Let's reframe the question a bit, what if owning the house and lease out made by as a company and I'm the CEO. I would take all the profit as a wage. So no profit, no dividend. What would happen with the share value? Would someone buy it?
In that case the value of the stock is just the value of the only asset (the house). So it would still have value, and for the same reason as a non-dividend-paying stock. You have a 50% claim to the assets in the event of liquidation or acquisition.