Lore Modification

Hi! I am trying to figure out how to add lines of lore to an item. Basically, I have a system that updates a wand whenever you use it (or drop it to swap its selected spell) by summoning it as an item and doing a bunch of complicated stuff with components, macros, and custom data before returning it to the player. I'm trying to add dynamic lore to it, and most of it I believe I can do with item modifiers, but I'm not sure how to create a list of all the spells stored in all of its slots (names and colours), and exclude all the slots beyond the maximum one. All the spells, plus their names and colours, are stored in different custom data paths. I don't really know how to add these lines to the lore, any help?
Continue to help post