The derivative that is being calculated at first is not ##\frac{\partial L}{\partial \dot x^1}##. It's ##\frac{\partial L}{\partial \dot x^p}##. That p index is what the part in red is addressing.
You miscalculated when you calculated ##\frac{\partial L}{\partial \dot x^1}##. You dropped a factor of two in calculating ##\frac{\partial}{\partial \dot x^1}g_{11}\dot x^1 \dot x^1##. This should be ##2g_{11}\dot x^1##, which means your second batch of stuff in red should be ##2g_{11}\dot x^1 + g_{12}\dot x^2 + g_{21}\dot x^2##. This is exactly the same as ##g_{l1}\dot x^l + g_{1m}\dot x^m##. Note how this expands upon doing the summation: ##g_{l1}\dot x^l + g_{1m}\dot x^m = g_{11}\dot x^1 + g_{21}\dot x^2 + g_{11}\dot x^1 + g_{12}\dot x^2##.