My question is for example I plan to buy a house later instead of saving in bank , I deposit in bank as a gold. Later if i want to use I can withdraw the money base on price of gold. Is it permitted like that?

No problem