$\lim_{X\to\infty}\lim_{n\to\infty} \sum_{i=1}^n f(X\cdot i/n)\cdot 1/n=\lim_{X\to\infty} \frac{1}{X}\int_0^X f(u)du=\lim_{X\to\infty} f(X)=a \tag{1}$
$\lim_{n\to\infty}\lim_{X\to\infty} \sum_{i=1}^n f(X\cdot i/n)\cdot 1/n=\lim_{n\to\infty} \sum_{i=1}^n a/n=\lim_{n\to\infty} a=a \tag{2}$
The double limit in $(2)$ is straightforward: $\lim\limits_{X\to\infty}f(X\cdot i/n)=a$ for each summand. However you cannot evaluate the version in $(2)$ and automatically say it equals the version in $(1)$, because in general you cannot interchange the order of two limits, e.g. $\lim\limits_x \lim\limits_y\, (x/y)$. However, since $f\to a$ in the limit, we have that $f\in (a-\epsilon,a+\epsilon)$ for any $\epsilon>0$ for all $X>N$ for some real $N$, which means
$\left|\frac{1}{X-N}\int_N^X f(u)du-a\right|<\epsilon $
ultimately implying
$\frac{1}{X}\int_0^X f(u)du=a+\mathcal{O}(X^{-1})\to a. $