I have 2 functions which interacts with unit.
1 function is summoning.
How can I store summoned unit into a global variable?
in the 2nd function i want to do some actions via global variables
It is possible, of course. You need to declare them outside the function and assign them nil. Then, you can modify them in every event and its content will be kept. For instance:
summon = nil
summon = "A summoned unit (actually a string)"
This will print to the console A summoned unit (actually a string) if OnSomethingHappens is triggered.
A summoned unit (actually a string)