A present-tense verb after لَمْ is negated with reference to a past action:
لَمْ يَغْزُ — he did not participate.
لَمْ يُحَدِّثْ — he did not entertain the thought.
نَفْسَهُ refers to “himself/his own soul,” and the final هُ returns to the person introduced by مَنْ. بِهِ refers to the previously mentioned matter. The two negative clauses thus concern both outward participation and inward intention.
At this stage, the aim is simply to recognize what لَمْ negates and where the pronoun points.