Yes, you can repair your sword using an anvil and either the same type of sword or materials used to craft it.