doing linklist of cities and get the total distance