You write, that you are computing the eigenvalues of a symmetric matrix. Does the matrix have real entries? In this case all eigenvalues are real, and you can use a symmetric eigenvalue solver, which returns only real entries. Hence, sorting them should not be a problem.
When your matrix has complex entries, you have to track the eigenvalues. I am assuming that your matrices change only slightly from one iteration of your loop to the next, meaning that the eigenvalues also change only slightly. Hence, you can find the eigenvalue of the next iteration that corresponds to the eigenvalue of the current iteration, by looking for the eigenvalue of the next iteration that is closest to the eigenvalue of the current iteration.
In general, sorting complex eigenvalues does not solve your problem. Consider the matrix
\begin{equation}
A(t) =
\begin{bmatrix}
e^{\mathrm{i} t} & 0 \\
0 & e^{\mathrm{i} (t + \pi)}
\end{bmatrix}
\end{equation}
for $t = [0, 2\pi)$. The matrix has two eigenvalues, both lie on the circle of radius one. The two eigenvalues lie on opposit sides of the circle and with increasing $t$ they rotate around zero. When $t$ is large enough the first eigenvalue reaches the point where the second eigenvalue has been, and vice versa. Hence, any sorting technique will (at latest) at that point, switch the roles of the two eigenvalues, even though the first eigenvalue moved slowly to the position of the second, meaning it has not changed its role.
If your eigenvalues vary only a little, you might get away with sorting the eigenvalues first by real part and then by imaginary part or by their absolute value. In general, however, this does not work.