Endomorphism kernel does not satisfy intermediate subgroup condition

Statement
It is possible to have a group $$G$$ and subgroups $$H \le K \le G$$ such that:


 * 1) $$H$$ is an endomorphism kernel in $$G$$, i.e., $$H$$ is a normal subgroup of $$G$$ and there is a subgroup $$M$$ of $$G$$ such that $$G/H \cong M$$.
 * 2) $$H$$ is not an endomorphism kernel in $$K$$.

Finite example
Take the following:


 * $$G$$ is particular example::semidihedral group:SD16.
 * $$K$$ is the subgroup particular example::Q8 in SD16 and is isomorphic to the quaternion group.
 * $$H$$ is the particular example::center of semidihedral group:SD16 and is isomorphic to cyclic group:Z2.

Then:


 * $$H$$ is an endomorphism kernel in $$G$$: The quotient group $$G/H$$ is isomorphic to dihedral group:D8, which occurs as D8 in SD16 in $$G$$.
 * $$H$$ is not an endomorphism kernel in $$K$$: The quotient group $$K/H$$ is isomorphic to the Klein four-group, which is not isomorphic to any subgroup of $$K$$ (see subgroup structure of quaternion group).

Infinite example that always works
We combine the fact that normal not implies endomorphism kernel with the fact that normal iff potential endomorphism kernel (note that the roles of the letters $$K$$ and $$G$$ as used on that page are the reverse of the roles here).