Finding path-lengths by the power of Adjacency matrix of an undirected graph
The powers of the adjacency matrix don't give you the number of paths but the number of walks between any two vertices. In other words, you need to consider walks such that some vertices/edges are repeated (which do exist).
You get the number of $k$ length walks. The difference between a path and a walk is that walks can repeat edges and vertices.