Keep variable value until serial input is changed

However, the LED turns off on its own since the serial monitor returns to a default value immediately.

More likely, you're sending carriage-return/line-feed.