Need help with custom msg datapack

so i have been trying to make a datapack like that changes instead of

X was slain by Y

It would go

X was slain by Y using [Diamond Sword]

And it will change the item name or color based on the item name change using an anvil

Can someone help me find whats wrong

Continue to help post