Create one file for handling storage and executing a command

Is there any way to not do this across 3 files but instead just 1

test data modify storage minecraft:helditem itemname set from entity @s SelectedItem.components."minecraft:custom_name" function emeraldequip:test2 with storage helditem

test2 $data modify storage minecraft:helditem itemname set value $(itemname) function emeraldequip:test3 with storage minecraft:helditem

test3 $say $(itemname)

Continue to help post