Positional parameters ($1, $2, $3, etcc...) are relative to what they're being passed into.
On invocation of your script you're using $1 and $2 as passed into the script at invocation which is correct.
Code:
Variable1="$1"
Variable2="$2"
However, your function is also expecting two variables passed into it as shown:
Code:
AddVariable () {
Variable1="$1"
Variable2="$2"
When you later run AddVariable to call that function at end of script you are not passing any variables into it so $1 and $2 aren't populated. You should make your final line:
Code:
AddVariable $Variable1 $Variable2
Within the function you might consider changing Variable1="$1" to a different name (e.g. FVariable1="$1") to avoid confusing the variable name within the function with the similar one outside the function.