The money has to be kept in the bank for as long as the visa is valid. You need to cancel the visa to withdraw the money.
How long do I have to keep my deposit in the bank account as a MM2H applicant in Malaysia?
I learned that upon approval of an MM2H application, the applicant must open a fixed deposit account of RM300,000. How long does the investor need to keep the deposit in the account?