Bear in mind that Safari tabs that are left dormant (not brought into view) for a certain period won't have their URLs returned by AppleScript, which will return missing value
in those instances. If this is an issue, you might have better results having the script save the tabs to a designated bookmark folder, which can be reserved for storing and re-storing groups of tabs as you please.