recover the lore of an item and then store it to put it back in the spell book and minecart

hi directly linked to : "retrieving information from a GUI" post I'd like to recover the lore of an item and then store it to put it back in the spell book and minecart each time. can you help me I've seen a lot of commands but it didn't do what I wanted.
Continue to help post