You are Looping throughout the Whole TileMap Which has 20x20 = 400 Tiles but your Array size its only 10x3
also, it's not very clear how you trying to save you Logic as to save on the exact coordinates that match the TileMap you need to use 2D Coordinates Example Array.At(X,Y)
then save the (TileID, X Coordinates, Y Coordinates) on the same Array Location separated by commas
Or
If you don't really need to match the Array.At(X,Y) to the TileMap Tile(X,Y) then you can set the Array Size at the start of the layout to Size = (Width =0, Height =3)
Then Push Back on the X = Tilemap.TileAt(loopindex("x"), loopindex("y"))
Then Set (Same X, 1) = Tilemap.TileToPositionX(loopindex("x"))
Then Set (Same X, 2) = Tilemap.TileToPositionY(loopindex("y"))
Like you were attempting to do, so you End up with
Array X all the Tiles Number
Array Y = 1 >>>All the X Positions
Array Y = 2 >>>All the Y Positions