We can use the following GAP functions to search examples of groups
with the desired properties:
IsExample := function ( G )
local p;
if not IsPGroup(G) then return false; fi;
p := PrimePGroup(G);
if Size(Centre(G)) <> p then return false; fi;
if Set(AbelianInvariants(G)) <> [p] then return false; fi;
return ForAll(Difference(AsList(G),AsList(DerivedSubgroup(G))),
g->IsSubgroup(Group(g),Centre(G)));
end;
AllExamplesOfOrder_n := n -> Filtered(AllGroups(n),IsExample);
What one finds is that all examples whose order is less than $10000$
and not equal to any of $2^9$, $2^{10}$, $2^{11}$, $2^{12}$, $2^{13}$
or $3^8$ and which are neither cyclic nor generalized quaternion groups
are the groups with the following GAP catalogue numbers:
gap> smallexamples := List([ [ 81, 10 ], [ 128, 802 ], [ 729, 96 ],
> [ 729, 101 ], [ 2187, 268 ],
> [ 2187, 272 ], [ 2187, 4486 ] ],SmallGroup);;
gap>
gap> List(smallexamples,AbelianInvariants);
[ [ 3, 3 ], [ 2, 2, 2 ], [ 3, 3 ], [ 3, 3 ], [ 3, 3 ], [ 3, 3 ],
[ 3, 3, 3 ] ]
gap> List(smallexamples,StructureDescription);
[ "C3 . ((C3 x C3) : C3) = (C3 x C3) . (C3 x C3)",
"C2 . ((C2 x (C4 : C4)) : C2) = (C4 x C2 x C2) . (C2 x C2 x C2)",
"C3 . ((C9 x C9) : C3) = (C9 x C9) . (C3 x C3)",
"C3 . ((C9 x C9) : C3) = (C9 x C9) . (C3 x C3)",
"C3 . (((C9 : C9) : C3) : C3) = ((C9 x C9) : C3) . (C3 x C3)",
"C3 . (((C9 : C9) : C3) : C3) = ((C9 x C9) : C3) . (C3 x C3)",
"C3 . ((C3 x C3 x ((C3 x C3) : C3)) : C3) = (C3 x C3 x C3 x C3) . \
(C3 x C3 x C3)" ]
Thus in particular the maximum $n$ which you can obtain for a group of
order less than $10000$ and not equal to any of $2^9$, $2^{10}$, $2^{11}$, $2^{12}$, $2^{13}$ or $3^8$ is $3$.