f[x_] := (x - 2) Cos[x];
x0  =  -π;  
    xf = π;

curvelength  =  
        NIntegrate[(Sqrt[1 + (((D[f[x], x]))^2)]), {x, x0, 
            xf}];

p1 =  
        Plot[f[x], {x, x0, xf}, PlotRange -> All, 
          PlotStyle -> 
            Thickness[
              0.005]];

NLim  =  30;
x = 
        Table[Table[x0 + (xf - x0) (i/n), {i, 0, n}], {n, 1, 
            NLim}];
y  =  f[x];

Δx  =  
        Table[Table[((xf - x0)/n), {i, 1, n}], {n, 1, 
            NLim}];
Δy  =  
        Table[Table[y[[n, i + 1]] - y[[n, i]], {i, 1, n}], {n, 1, 
            NLim}];


curvelength1 = 
        Table[N[(∑_(i = 1)^n)(Sqrt[(((Δx[[n, i]]))^2) + (((Δy[[n, i]]))^2)])], {n, 1, 
            NLim}];
curvelength2 = 
        Table[N[(∑_(i = 1)^n)(Sqrt[ 1 + (((Δy[[n, i]]/Δx[[n, i]]))^2)]) (Δx[[n, 
                      i]])], {n, 1, 
            NLim}];

Table[{Table[{x[[n, i]], y[[n, i]]}, {i, 1, n + 1}], 
          Show[{p1, 
              Graphics[{Thickness[0.0075], RGBColor[0, 0, 1], 
                  Line[Table[{x[[n, i]], y[[n, i]]}, {i, 1, 
                        n + 1}]]}]}, 
            PlotLabel ->  curvelength1[[n]]]}, {n, 1, 
          NLim}];

lp1 =  
      ListPlot[curvelength1, 
        PlotStyle -> {Thickness[0.01], RGBColor[0, 0, 1]}, 
        PlotJoined -> True, PlotRange -> All, 
        AxesOrigin -> {1, 8.5}, DisplayFunction -> Identity]; 
    lp2 = 
      ListPlot[curvelength2, 
        PlotStyle -> {Thickness[0.0025], RGBColor[0, 1, 0.5]}, 
        PlotJoined -> True, PlotRange -> All, 
        AxesOrigin -> {1, 8.5}, 
        DisplayFunction -> Identity];
Show[{lp1, lp2}, 
        DisplayFunction -> $DisplayFunction];

curvelength