The problem isn't in the code you provided, but probably in a way you formatted the lists.
All that code does is pass a string into the method loadItemList or loadItemPrices.
In those methods it probably converts the stuff inside the file into something you can utilize, e.g. an array. It probably splits values \t, but you probably used spaces instead -> causing it to just mess up in general