After enter your code, enter a name for it and click in Add button.
from GE documentation.
Well i don't know if it is a bug or not, but clicking on Add doesn't seem to record my code. when i do ADD in Global code, i go back to Script mode and have no other choice but to click on Close.