"work to do something" does indeed mean "to endeavor" or "try one's best." It gives the impression that the person is doing something that is important to them and they want to improve themselves or the situation around them. In this case, "working to protect my city" means the speaker has been doing everything he can to keep the city safe.