write pathend (x,y) position into array