To Rename a Item:
/rename <Text>
To extend the Name:
/rename add <Text>
To make it easier, there's a Website where you can enter the Text and the Style and the Command are created automatically for you.
If you find any bugs or have any Datapack/Mod suggestions, please let me know on my Discord.
This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects.