if $h$ divides $\# G$, then it is not necessarily that $G$ has a subgroup of size $h$
which can be related to Lagrange Theorem $[G:H]=\frac{\#G}{\# H}$ in the case when the subgroup exists, however it is not generally true such as in the case of $\mathbb A_4$ with order of 12 and having no subgroup of 6. So
How can you demonstrate the proposition of the highlight in GAP?
If you want to check whether a particular group would be a counterexample to the (wrong) converse of Lagrange's theorem you probably cannot do better than to calculate the subgroups. In GAP, the command
will return a list with the orders of subgroups of $G$ and in the second command determine the orders for which there are no subgroups.