Save as "stay open script"?

I have a script that I have to save as “stay open script” on the web I saw that I can use “on idle” but it doesn’t work for me:(

Please tell what other ways of saving it as stay open script:|

The structure of an “on idle” script is:

on run
-- do stuff only needed at first run
-- on run not required
end run

on idle
-- runs immediately after "on run" anyway and then repeats
-- do periodic stuff
return n (seconds between repeats as a number)
end idle

on quit -- not required
-- do stuff only when quitting, e.g. clean up or save data
continue quit -- absolutely essential last command
end quit

Save the result as a bundle application. Double click to start, stop from Dock.

But can I solve this problem using on idle?