Evaluate derivative of Lagrange polynomials at construction points
Just to complement the answer, here is the formula for second derivative: $$ L^{"}_i(x) =\sum_{l\ne i}\frac{1}{x_i-x_l}\left( \sum_{m\ne(i,l)}\frac{1}{x_i-x_m}\prod_{k\ne(i,l,m)}\frac{x-x_k}{x_i-x_k}\right) $$ through recursion, one can compute further higher derivatives.
I think your implementation is correct. You copied the wrong formula.
$$L'_i(x)=L_i(x) \sum_{m=0,\ m\neq i}^n\frac1{x-x_m}$$
This formula would not give you zeros everywhere else.
And this is the same as your new derived formula.