Yes. There are nine ordered pairs $\displaystyle (i, j)$, and three of them (with equal elements) give rise to $\displaystyle |X_i - X_i| = 0$. The other six are split into three pairs because $\displaystyle |X_i - X_j| =|X_j - X_i|$.
If you want just $\displaystyle |X_1-X_2|+|X_1-X_3|+|X_2-X_3|$, you can denote it by $\displaystyle \sum_{1\le i<j\le 3}|X_i-X_j|$.
On line 4, you keep i=1 for all three terms. On line 5, you keep i=2 for all three terms. Then on line 6, you keep i=3 for all three terms.
It should read (beginning on line 4):
$\displaystyle \begin{align*}= & \hspace{1em}\hspace{3pt} |x_1-x_1| + |x_2-x_1| + |x_3-x_1| \\ & + |x_1-x_2| + |x_2-x_2| + |x_3-x_2| \\ & + |x_1-x_3| + |x_2-x_3| + |x_3-x_3| \\ = & \hspace{1em}\hspace{3pt} 0 + |x_2-x_1| + |x_3-x_1| \\ & + |x_1-x_2| + 0 + |x_3-x_2| \\ & + |x_1-x_3| + |x_2-x_3| + 0 \\ = & \, \left(|x_1-x_2| + |x_2-x_1|\right) + \left(|x_1-x_3| + |x_3-x_1|\right) + \left(|x_2-x_3| + |x_3-x_2|\right) \\ = & \, 2\left(|x_1-x_2| + |x_1-x_3| + |x_2-x_3|\right)\end{align*}$