I have an idea to be added to the code:
I think it is good I idea if you can add a code to check if the list and the elements exist or not because you use the script twice it will make a duplicate element’s in the list.