First, let's see what is this map $H^2(\pi_1(X),A) \rightarrow H^2(X,A)$.
$\pi_1(X)$ is characterized by the following property: A set endowed with a left action of $\pi_1(X)$ is the same thing as a locally constant sheaves over $X$.
This mean in particular that there is a natural functor from $\pi_1(X)$-sets to the category $Sh(X)$ of sheaves of set over $X$. This functor is the pullback functor along a geometric morphism of toposes $X \rightarrow B\pi_1(X)$ (where $X$ denotes the topos of sheaves over $X$ and $B\pi_1(X)$ the topos of sets with action of $\pi_1(X)$.
The cohomology of the topos of sheaves is the ordinary cohomology of topological space and the cohomology of $B\pi_1(X)$ is ordinary group cohomology. So this map you are talking about is from this perspective just the natural action of a continuous map on cohomology.
Now, unless you are willing to use a description of element of $H^2(_,A)$ as sheaves of groupoid with a $BA$-action, a more explicit answer to your question is I think a bit more tricky... Indeed geometric description of cohomology class that are general enough to encompass those two kind of toposes are a bit complicated and not very easy to use in explicit situation. And the two explicit descriptions you want to use are of very different kind and uneasy to relate :
The description of $H^2(X,\mathbb{Z})$ in terme of line bundle:
Let me denote by $\mathbb{C}^*, \mathbb{R}$ and $\mathbb{U}$ the sheaves of continuous function with value respectively in $\mathbb{C}^*$, $\mathbb{R}$ and $\mathbb{U}$ the group of complex numbers of module one.
This description then comes from the fact that line bundle are classified by $H^1(X,\mathbb{C}^*)$ and that when $X$ is para-compact you have $H^1(X,\mathbb{R})$ and $H^2(X,\mathbb{R})$ that are all trivial hence the exponential long exact sequence induce an isomorphism $H^2(X,\mathbb{Z}) \simeq H^1(X,\mathbb{U})$ and as $\mathbb{C}^* \simeq \mathbb{R} \times \mathbb{U}$ one has $H^1(X,\mathbb{U}) \simeq H^1(X,\mathbb{C}^*)$. All these identification are false for the topos of $\pi_1(X)$-sets so there is no way to use a similar description. Worst, the natural comparison map that always exist is in the direction $H^1(X,\mathbb{U}) \rightarrow H^2(X,\mathbb{Z})$ hence the wrong direction for associating line bundle to exact sequence... so we will at least need to use explicitly that $H^2(X,\mathbb{R})=0$.
The description in terms of exact sequences... well there is probably dozens of way of explaining it, but anyway it boils down to very specific properties of the topos of $\pi_1(X)$-sets and there is no analogue for $Sh(X)$... except actually something like the construction of ACL's comment but that does not goes in the correct direction to answer the question.
So I don't think there an easy way to express this relation without going through a description of cohomology class that is common to the two toposes.
A first solution would be to replace the topos $B\pi_1(X)$ by a homotopy equivalent space for which the equivalence between line bundle and $H^2(Y,\mathbb{Z})$ holds, i.e. the Eilenberg Mac-lane space of $\pi_1(X)$, and this is exactly what Mathias Wendt proposed in his comment. But you will have to understand how an extension gives rises to a line bundle on the Eilenberg Mac-lane space anyway.
If one just want to compute this map, one can use a "cocycle" description:
Let $ 1 \rightarrow A \rightarrow T \rightarrow \pi_1(X) \rightarrow 1$ be a central extension.
Let $p: Y \rightarrow X$ be the universal cover of $X$ with its canonical (left) action of $\pi_1(X)$. let $(U_i)$ be an open covering of $X$ that trivialize the etale covering $Y \rightarrow X$ and for each $i$ let $V_i$ be an open subset of $Y$ such that $p$ induces an homomorphism from $V_i$ to $U_i$.
For each $i,j$ such that $U_i \wedge U_j$ is non empty there is a unique element $\gamma_{i,j} \in \pi_1(X)$ such that $\gamma_{i,j}$ induces an homomorphism between $V_i \wedge p^{-1}U_j$ and $V_j \wedge p^{-1}(U_i)$ above $U_j \wedge U_i$. So, for example, $\gamma_{j,i} = \gamma{i,j}^{-1}$ and $\gamma_{j,k}\gamma_{i,j} = \gamma_{i,k}$ at least when $U_k \wedge U_i \wedge U_j$ is non-empty.
For each $i,j$ pick $\alpha_{i,j} \in T$ a lifting of $\gamma_{i,j}$,
And finally, for each $i,j,k$ such that $U_i \wedge U_j \wedge U_k \neq \emptyset$, let $V_{i,j,k} := \alpha_{k,i} \alpha_{j,k} \alpha{i,j}$. Then I claim that $V_{i,j,k}$ is in $A$ (its image in $\pi_1$ is trivial) and it defines a cocycle whose cohomology class does not depend on any of the choices done and is the one you are looking for (maybe up to a minus sign because I haven't been very careful).
For the special case $A = \mathbb{Z}$, whatever you do, you will need at some point to use that $H^2(X,\mathbb{R}) = 0$ in order to construct a line bundle. Maybe there is some simpler description in specific case, for example manifold, relying on specific existence results implying that $H^2(X,\mathbb{R})=0$.
Here it appears in the fact that in order to turn our $3$-cocycle with value in $\mathbb{Z}$ into a $2$-cocyle with value in $\mathbb{U}$ which will define a hermitian line bundle we need to construct first a trivialisation of it when seen as a cocycle with value in $\mathbb{R}$. This is done by using a partition of unity $\chi_i$ subordinate to the open cover $(U_i)$ we started with:
For any $i,j$ such that $U_i \wedge U_j \neq \emptyset$ let:
$$ \lambda_{i,j} = \exp\left( 2i\pi \sum_k \left( \chi_k V_{i,j,k} \right) \right) $$
give you the $2$-cocyle with value in $\mathbb{U}$ required for the construction of the line bundle.