How can I update the value inside a custom function from another custom function?

How can I update the value inside a custom function from another custom function?

Hello there,

I have two custom functions right now, one of them has a variable called 'token' inside of it, and then I have another function (custom function) that I want to use to update the 'token' variable I have in custom function 1, is this possible by using REST API functions?

To illustrate it better, I have custom function that looks like this:

Custom function 1()
token = "abc123";
return token;

then from custom function 2, I want to modify the value 'token' in custom function 1, using the API type of function (so I made custom function 1 to be REST, and I added arguments on it, so my final custom function looks like this:  

customFunction1(token)
mytoken = "";
if(token != ""){
mytoken = token;
}
return mytoken;

Then, I have tried to do this code in custom function2:

customfunction2()
updatecustomFunction1 = invokeUrl
[
URL: "the URL to get to my function"
Method: POST
parameters {"token":"testtoken"}
connection: myconnection
];

when I run the above code, I get a blank value for the output, am I doing something wrong or is this just not possible?