You have to create this Item for the code above to work.
Items retain their state between Rule runs. This particular Item is called Design Pattern: Unbound Item (aka Virtual Item).
Global variables retain their state between Rule runs. Rules | openHAB
Items configured with persistence and restoreOnStartup strategy retain their values between restarts of openHAB. Persistence | openHAB
Design Pattern: Encoding and Accessing Values in Rules shows a lot of ways to initialize the value of an Item.