Hey wierd bug that I don't know how to fix

So I'm making a map that make so that player will have netherite armor another way than crafting it so i wrote this peice of code that in my creative world work and made sure i couldn't grab the normal set from the inventory buy the one I made

Now the bug is that when i did it in survival and I took the neth sword and click on my pick to change it the pick would get cleared for no reason. How do i fix it ?

Continue to help post