In distant future major breakthrough in bionanotechnology means longer life expectancy and free from diseases such as cold and cancer, billions of nanites flowing inside our body constantly repairs damaged cells and restore DNA... my question is how can we prevent these nanites from altering our DNA either for improvement since it deemed human as flawed or rather abide by its purpose and halt evolution in long run rendering our species unable to adapt to environmental and climate changes? (I think the three laws of robotics cannot apply here because cells and proteins isn't human.)
As long as the nanites are not making your children have the same DNA as you then everything will be fine. You personally will never experience evolution, as it should be. As for epigenetics, if we have advanced in medicine enough to know how to build DNA repairing nanites, we can instruct them what changes to allow and which to prevent.
The idea that a nanite would be capable of determining what DNA changes would lead to an "improvement" of a human is a bit far fetched. All it knows is what the DNA is supposed to look like, not what it does. It requires a knowledge and bigger picture view that any simple maintenance robot wouldn't have. It might be programmed to modify DNA, like a genetic therapy, but it won't be doing this by itself.
Repairing and restoring the DNA in the host body (an individual) will not prevent adaptation for future generations. The process of procreation mixes DNA and mutations would be part of the new being (the child inside). Repair is a much 'simpler' job to do than 'enhance' DNA. Repairing just needs to look for anomalies in the cells, Altering DNA to something else in order to 'make it better' is much more difficult.
Nanites are not the evil genius that they are believed to be. Each one will have very limited memory and abilities, more like a single ant from a colony. It will be colony behaviors that make the difference with different nanites each with simple jobs but working together make a huge difference.