How do I keep arduino working after unplug

dnnyau:
I like to know how I record that scketch in the arduino, and don't have this problem!!

It can't run without being uploaded. It also doesn't erase itself. However there was a bug with one of the bootloaders where it would not exit to your program (so the sketch would seem to have gone) if it wasn't plugged into the USB ... or something.

I suggest upgrading the bootloader.