To use a participle or an infinitive? That's the question

You have two possibilities, both grammatical, but with different meanings

  1. "harming" means that they did not, in fact, harm the mice
  2. "to harm" means that they took the care for the purpose of refraining from the harm.

Either harming or to harm would work, but the sentence really needs an again at the end since they already harmed them before.