Mark Grant's excellent answer already resolves the question. However, let me sketch how this arises as a special case of the more general problem of classifying fibrations with a given fiber.

For any space $X$, the *homotopy automorphisms* $\operatorname{hAut}(X)$ are defined as the self-homotopy equivalences of $X$ (topologized with the compact-open topology; note that they form a union of path components of the space of all self-maps of $X$). They form a group-like monoid, so there is a connected pointed space $B\operatorname{hAut}(X)$ such that there is an equivalence of $A_\infty$-spaces $\operatorname{hAut}(X)\simeq \Omega B\operatorname{hAut}(X)$. In fact, $B\operatorname{hAut}(X)$ can be built as the geometric realization of the simplicial space $B(*,\operatorname{hAut}(X),*) = * \leftarrow \operatorname{hAut}(X) \Leftarrow \operatorname{hAut}(X)\times\operatorname{hAut}(X) \Lleftarrow \dots$. Since $\operatorname{hAut}(X)$ acts on $X$ from the left, we can also build the simplicial space $B(*,\operatorname{hAut}(X),X) = X\leftarrow \operatorname{hAut}(X)\times X\Leftarrow\dots$, and the map $X\to *$ induces a fibration $X\to E_X\to B\operatorname{hAut}(X)$. This is the universal fibration with fiber $X$, that is, for every fibration $X\to F\to Y$ there is a unique homotopy class of maps $f: Y\to B\operatorname{hAut}(X)$ such that $F\simeq f^*E_X$.

If $X = K(A,n)$ is an Eilenberg-MacLane space, the grouplike monoid $\operatorname{hAut}(X)$ can be described quite explicitly: In this case, $X$ can also be given the structure of a grouplike monoid with identity $e$, so that the map $\operatorname{hAut}(X)\to X, f\mapsto f(e)$ has a homotopy right inverse given by sending $x$ to (left, say) translation by $x$. Thus there is a homotopy equivalence $\operatorname{hAut}(X)\simeq \operatorname{hAut}_*(X)\times X$, where $\operatorname{hAut}_*(X)$ is the submonoid of self homotopy equivalences that preserve the basepoint (note, however, that this is not compatible with the monoid structure). Now it is straightforward to show that $\operatorname{hAut}_*(K(A,n))\simeq K(\operatorname{Aut}(A),0)$ is homotopy equivalent to a discrete space, and there is a retraction $\operatorname{hAut}(X) \to \pi_0(\operatorname{hAut}(X))\cong \operatorname{Aut}(A)$. All in all, we obtain an equivalence of grouplike monoids
$$
\operatorname{hAut}(K(A,n))\simeq \operatorname{Aut}(A)\ltimes K(A,n)
$$
It follows that $B\operatorname{hAut}(K(A,n))$ has exactly two nonvanishing homotopy groups, namely $\pi_1(\operatorname{hAut}(K(A,n)))\cong \operatorname{Aut}(A)$ and $\pi_{n+1}(\operatorname{hAut}(K(A,n)))\cong A$, with the evident action of $\pi_1$ on $\pi_{n+1}$. In particular, a map $f:Y\to B\operatorname{hAut}(K(A,n))$ is determined by $\rho\in H^1(Y;\operatorname{Aut}(A))$, which determines a local system $A_\rho$ on $Y$, and a cohomology class $[f]\in H^{n+1}(Y;A_\rho)$.