How can I make a tool unbreakable?

Sadly, you can't really do this with a single command, because in Bedrock Edition, there is no such JSON component for enchanting using the /give command.

So it's better to just do:

  1. /give netherite_sword
  2. /enchant unbreaking 3 (whilst holding sword)

Optional enchantment: /enchant mending

Also, to put it simply, you cannot really have an unbreakable item. This requires an NBT editor, which means getting the sword (or something else) to be unbreakable by a higher level of Unbreaking.