I have a loop controller in my test plan with a counter called fileNumber.

I also have a groovy script which fetches keys and uploadIds from the response of an API call. This is the script I have:
def uploadId = vars.get("uploadId");
def fileKey = vars.get("key");
def fileNumber = vars.get("fileNumber");
if (!uploadId.isEmpty() && !fileKey.isEmpty()) {
vars.put("key_" + fileNumber, fileKey);
vars.put("uploadId_" + fileNumber, uploadId);
}
I expected this to create variables for key as key_1, key_2...key_5.
What I get, is that key_1 is stored correctly in the first call of the API in the loop:

But in the 2nd to 5th iterations of the loop, the variables for the 2nd to 5th values are stored.

The variable key_1 is not set at all.
When I give the start value as 0 and maximum value as 4, then I get key_0, key_2, key_3, key_4. But still no key_1
Why is this happening?
When I changed the variable name to fileKey, it worked. I'm assuming it's because key_1 is saved somewhere but I have not defined key_1 as a variable elsewhere