In line 2 you say:
$var = $startFormat.$i;
What that is doing is concatenating (sticking together) the values of two variable - $startFormat and $i. So if you've defined $startFormat somewhere else as, say "chicken", then as you loop through the loop , $var would be "chicken1", "chicken2", etc. If you DON'T define $startFormat somewhere else then I think it's basically empty, so you'd get simply "1", "2", etc.
If instead you want $var to be the value of a variable called $startFormat1, $startFormat2, and so on, you have to do it in two steps, which you can combine into one. First you have to set the name of the variable, by combining the unchanging "text" part of the name with the variable that tells which loop you're on:
$var_name = "$startFormat" . $i;
Then you can find the value of this variable by evaluating it, which is what the curly brackets do (this line includes both steps):
$var = {"$startFormat" . $i};
Or, using tekky's syntax, you could write:
$var_name = "$startFormat" . $i;
$$var = $var_name;
You have quite a number of instances of
$startFormat . $i
Throughout your script, which unless you define $startFormat elsewhere are just going to evaluate as the value of $i.
So - fix the second line of your script, and then replace all the instances of "$startFormat . $i" throughout with "$var" and you should be good.