Once you become an NRI, you have the following options for the treatment of existing shares:
Hold existing shares in resident Demat account
In case you have no intention to make any fresh investment, you can hold the existing shares bought as a resident Indian in the resident Demat account. However, this is advisable for a temporary period or if you are on a temporary assignment. However, from a long term perspective, it is better to go with option 2 or 3.
Transfer the shares in the new Demat account
When you become an NRI, you cannot continue with your holdings in the existing Demat account especially if you are intending to make fresh investments. You have to open a new Demat account with NRI status and transfer the existing shares into the newly opened NRO account.
Sell off the shares or gift the shares before becoming an NRI
In case you have no intention to make new investments as an NRI, it is better to sell off the existing shares or gift the shares to your relative before becoming an NRI to avoid any complexities at a later date.