You are asking for solutions $f$ to the simple differentiable equation $$f^{(n)}=f$$ that make $f$ real-valued for real-values of $f$ and not of lower degree $k$th-derivative-wise. As is well-known, the solution is given by $$f(x)=\sum_{j=0}^{n-1}c_j\exp(\zeta^jx)\,,$$ for some constants $c_j$ and $x\in\mathbb{R}$, where $\zeta=\exp(2\pi i/n)$. Because you desire $f$ to be real-valued, this becomes equivalent to $f(x)=\overline{f(x)}$, which becomes equivalent to $c_{n-j}=\overline{c_j}$ for all $j$; and because you require $f$ not to be of lower degree $k$th-derivative-wise, that will mean the indices of the non-vanishing coefficients should not form a proper subgroup of $\mathbb{Z}/n\mathbb{Z}$.