Power of adjacency matrix
As you probably know, $A^i_{st}$ is the total weight of walks of length $i$ from $s$ to $t$. Since
$$
\sum_{i=0}^k (xA)^i = \sum_{i=0}^k A^i x^i,
$$
the $s,t$ coefficient of $A_{G'}$ is
$$
\sum_{i=0}^k A^i_{st} x^i.
$$
This is a polynomial in which for $0 \leq i \leq k$, the coefficient of $x^i$ is the total weight of walks of length $i$ from $s$ to $t$.