Help with inventory?

Anyone can help me fix this inventory something is wrong and I can’t fix it

My favourite line. Loops look dodgy AF:

You’re not looping through anything and just use the last element. No one will ever know how to fix that unless you describe in very fine detail how it’s supposed to work.