Hi
Scenario 1: Using VAR
When you use VAR on the variable, the changes that you make in the subscribers will remain.
For Ex.

This is one of the events in CU 80. Where the SalesLine variable is having VAR and SalesHeader doesn't have it. So when you subscribe to this event any changes you make to the variable SalesLine will be also available after coming out Subscriber.
Scenario 2: Using Single Instance CU
For this, you must create a Codunit and set the property SingleInstance=true.
So in this case, u can create a function in this CoduUnit like SetValue and GetValue.

You can use the SetValue function to store the value in the variable and GetValue can be called where you want to use it.
Refer to the below link for better understanding,
https://docs.microsoft.com/en-us/dynamics-nav/singleinstance-property
Help the community by making answer verified if it solves your issue.
Regards,
Avinash B