I find that the change of the code example of an asset used to be saved automatically when you have run the code in the sandcastle. But these days it was not the case and I do not know how to save the code. Could you please tell me how to deal with that?
You can always get a shareable link to a sandcastle demo. This will essentially “save” your progress.
In general, sandcastle is designed to allow users to create quick mockups. For more extensive testing, I recommend setting up a local version of CesiumJS.