Here is how I would write this script:
-- Scripted by Ramiro Jesse Grant for Phoenix OTS
local storage = 51222
local count = 1
local bag = 2330
local items = {
[1] = {7407, 2445, 7455}, -- Knight Items
[2] = {8868, 2122}, -- Druid/Sorcerer Items
[3] = {8858, 2352} -- Paladin Items...