can we make a variable in a function as global variable
No it's local variable. you can see this post if you want to pass variable/value
You can make it global within an action, but must pass between actions. It would be accessible to the action and any other functions called by the action.
Which if you have a framework built around function libraries and only have one action, would be effectively global.
You can declare global vars in the headers of function libraries. IE in the function library file outside of any function/end function pairs.
Such variables are available from anywhere so long as that function library is associated with your test.
You can use Environment Variable as a Global Variable.
I don't build Software but I make them work better, Testing is a Passion
You can System Environment variable
Winds of Change