how can i make it so function activates on rightclick?

im trying to make a datapack i want to make it so when rightclicking item activates a function i cant seem to get it working

Continue to help post