There are several questions here. First, do you infringe on an existing patent. To assess this, you need to carefully read the claims of the existing patent. To infringe on a patent, you need to implement every part of at least one claim. Thus if a patent has a claim which shows a method of water purification with step A, B and C, if your method implements steps A, B and C you infringe. If however, your method only uses steps A and C or perhaps, steps A, B and a new step D, you possibly avoid infringement. What is important to remember, is the idea of purifying water isn't patented, only a specific implementation for achieving that function. And the specific implementation is defined by the patent claims.
A second question has to do with improving the technology described in the existing patent. If you find a method of improving an existing invention, you may be able to get a patent on that improvement. This enables you to stop anyone from practicing the improvement including the inventor of the original technology. However, the improvement by it self doesn't avoid infringement of the original patent.
I would caution you that reading and understanding patents isn't always straightforward and I would greatly recommend that you access a patent lawyer or agent to help you assess both infringement and potential patentability of your implementation.