Edit. In fact, any nontrivial abelian $p$-group $A$ can be realized as the center of a $p$-group with index $p^n$ except in the case $n=1$ (if $A$ is trivial, then it cannot be the center of a nontrivial $p$-group). As has been noted, if $N\subseteq Z(G)$ and $G/N$ is cyclic, then $G$ is abelian, so no group can have a center of prime index. For $n=0$, you can just take $A$ itself.
For $n\gt 1$, we can use the same trick as the one used by Konstantin Ardakov in the comments: take a group $K$ of order $p^{n+1}$ and class $n$ (such groups are called "$p$-groups of maximal class; I'll give an example below). Such a group $K$ has $Z(K)\cong \mathbf{C}_p$, cyclic of order $p$. Let $k$ be a generator of $Z(K)$. Now let $a\in A$ be an element of order $p$, and take the amalgamated direct product $G=(A\times K)/\langle (a,k^{-1})\rangle$. It is easy to verify that $Z(G)\cong A$, and $G/Z(G)\cong K/Z(K)$, and $K/Z(K)$ has ordder $p^n$.
Leedham-Green and McKay's The Structure of Groups of Prime Power Order (London Math. Soc. Monographs, new series, no. 27), has several examples of $p$-groups of maximal class in Section 3.1. Here are some: for $p=2$ you can take the dihedral, semidihedral, or generalized quaternion groups of order $2^{n+1}$. For odd prime $p$, the analogue of the dihedral group is as follows: let $K_p$ be the $p$th local cyclotomic number field, let $\mathcal{O}$ be its valuation ring, and let $\theta$ be a primitive $p$th root of unity. Let $\mathfrak{p}=(\theta-1)$ be the maximal ideal of $\mathcal{O}$. Then $\mathcal{O}$ is a $C_p$-module, with the generator acting like multiplication by $\theta$. The ideals $\mathfrak{p}^i$ are invariant under the action. We define $\mathbf{E}_{p^n} = (\mathcal{O}/\mathfrak{p}^{n-1})\rtimes \mathbf{C}_p$. This group has maximal class and order $p^{n}$.
(Other examples: $\mathbf{C}_p\wr\mathbf{C}_p$ is a $p$-group of maximal class and order $p^{p+1}$. Or let $A$ be an elementary abelian $p$-group of rank $d$, let $M\in\mathrm{GL}(d,p)$ be the matrix that has $1$s in the diagonal and right above the diagonal, and zeros elsewhere. Then $A\rtimes\langle M_d\rangle$ has maximal class if and only if $3\leq d\leq p$).
On the other hand, you may want simpler groups, say groups $G$ with $Z(G)\cong A$, $[G:Z(G)]$ of order $p^n$, and $G/Z(G)$ abelian.
An old paper of R. Baer, Groups with preassigned central and central quotient groups, Trans. Amer. Math. Soc. 44 (1938), no. 3, 387-412, MR1501973, available on-line here, can be used to determine which abelian $p$ groups can be embedded as the center of a group of class two with index $p^n$ for any $n\gt 1$. The paper considers the problem addressed in the title, and has both an existence and a uniqueness theorem. The existence theorem is restricted to the case in which the central quotient group is a direct sum of cyclic groups, and the uniqueness theorem is further restricted to the case in which the central quotient is finitely generated.
Now, since $G(p)=G$, and $pG=0$, for point 6, note that for any $i\gt 1$ we have $r(G,p^i)=0$; and $r(G,p)=n$; if $n$ is even, then 6 is satisfied vacuously, so you can always obtain a group. You can realize it taking an element $x$ of order $p$ in $A$, letting $G$ be the extraspecial $p$-group of order $p^{2n+1}$ with center generated by $c$, and taking the group $A\times G/\langle (x,z^{-1})\rangle$, an amalgamated direct product; same idea as the construction given by Konstantin ArdakovKonstantin Ardakov in the comments.
(For odd And if $n\gt 1$$n\neq 1$, you could have thatthen any nontrivial abelian $H$ is of class greater than$p$-group $2$, and it seems harder to see if you$A$ can always get an embedding)be realized as the center of a group $G$ with $[G:A]=p^n$.