Scoreboard to NBT trouble plz help

I'm very new to datapack creation, im makeing a system that subtracts one durability from an object when you right click it among other things. I have a scoreboard called flamethrower_damage, i need to make that scoreboard the new value of the damage NBT for the item @s is holding in their main hand. for clarification this is not damage its the damage to durability which in the nbt is just called damage, if it helps my base item is a wooden sword. if you say anything please @me

Continue to help post