Given a cyclic group $C_p$ and an abelian (noncyclic) group $K$ with $|K|$ divides $p-1$. Is it always possible to construct a nonabelian group $G \cong C_p\rtimes K$ with $Z(G) \cong C_p$?? If such group can be constructed, How could the homomorphism $\varphi:K \to \operatorname{Aut}(C_p)$ be defined?
It is clear that if $K$ is cyclic then such group can not be constructed, because in this case we get $G/Z(G) \cong K$ which force $G$ to be abelian and hence $G=Z(G)$ which is not possible.