Mathematica's Graph related functionality is pretty great. You can easily style vertexes, edges and their labels, apply interesting functions. For small increase in code sophistication you gain quite a bit of advantage. Your data:
poli = {{1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {5, 2}, {4, 2}, {3,
2}, {2, 2}, {1, 2}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}, {5,
4}, {4, 4}, {4, 5}, {5, 5}};
A simple solution with still quite wide styling options I think would be this
arrow[coord_, e_] := Style[Arrow[coord], Red, Thickness[.01], Arrowheads[0.06]]
pg = PathGraph[Range[19], VertexCoordinates -> poli,
EdgeShapeFunction -> arrow, ImageSize -> 300, PlotRangePadding -> .2];
gg = GridGraph[{5, 5}, EdgeStyle -> Dashed, VertexLabels -> "Name",
ImageSize -> 300, PlotRangePadding -> .2];
Overlay[{gg, pg}]

The rest is some more elaborate exploratory fun with graphs.
We'll use GridGraph again but instead of PathGraph we'll use GraphHighlight option. GridGraph has its own 1D node index system (see indexes above), not 2D indexes as in matrix. So we have to remap the indexes.
vertex = (5 (#[[1]] - 1) + #[[2]]) & /@ poli;
edge = ( #[[1]] \[UndirectedEdge] #[[2]]) & /@ Partition[vertex, 2, 1];
To add correct labels:
lab = MapThread[Rule[#1, ToString@#2] &, {vertex, poli}];
GridGraph[{5, 5}, EdgeStyle -> Dashed, GraphHighlight -> edge,
VertexLabels -> lab, PlotRangePadding -> .3]

If you want arrows there are many ways around, especially depending on how you choose the path. Quick cooking gives something like this:
arr[coord_, e_] :=
Style[Arrow[
If[Positive[(e)[[2]] - (e)[[1]]], Identity[coord],
Reverse[coord]]], Red, Thickness[.01], Arrowheads[0.06]]
GridGraph[{5, 5}, EdgeStyle -> Dashed, GraphHighlight -> edge,
VertexLabels -> lab, PlotRangePadding -> .5,
EdgeShapeFunction -> (# -> arr & /@ edge)]
