Edit terrain using js

If i edit terrain using

terrain.terrainData.SetHeights(0, 0, heights);

And i stop the game, all modifications are in the editor.
How do the changes were only in the game.

I believe this only renders the terrain data in the game, say if you wanted to dig within the game you could use that method. If you want to set the heights you can use a height map. You can also edit the the terrain from the inspector.