Let $P$ be a quaternion of order 8 and $Q$ a cyclic group of order 9 and $G=[p]Q$, a semidirect product ($P$ is normal in $G$).
Let $M$ be a maximal subgroup of $G$ such that $Q<M$. I want to find $|G : M|$=? in gap.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
There's really no need to use GAP.
There are two possibilities, according to the action of $Q$ on $P$.
If the action is trivial, then $M$ has index 2, and it is the product of $Q$ with one of the (cyclic) subgroups of $P$ of order $4$.
If the action is non-trivial, then $Q$ permutes cyclically the three subgroups of $P$ of order $4$. Then $M$ has index 4, and it is the product of $Q$ with the subgroup of order $2$ of $P$.