I want to prove that if $X$ is a separable metric space, then for all $x,y \in X$ and any dense set $\{x_i\}$, we can write:
$$d(x,y) = \sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i) |.$$
Some attempts. One side: fix $x,y$, by denseness there exists a subsequence $x_{n_{k}}$ of $x_n$ such that $x_{n_{k}}$ converges to $x$. This implies $$\sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i) | \geq \sup_{k \in \mathbb{N}} |d(x,x_{n_{k}}) - d(y,x_{n_{k}}) | = d(x,y) $$ even if I am not even sure about how to justify the last passage since it's a supremum and not a limit. Moreover I cannot do the other inqeuality. How can I proceed? Thanks.
Your proof for the inequality $d(x,y) \le \sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i)|$ has the right idea, but as you noticed, it's not rigorous since you didn't justify that $\sup_{k \in \mathbb{N}} |d(x,x_{n_{k}}) - d(y,x_{n_{k}}) | = d(x,y)$.
You can argue as follows instead : since $\{x_n\}$ is dense, you can have find a subfamily $\{x_{n_k}\}$ such that for all $k\ge1$, $d(x,x_{n_k})\le 1/k$. Furthermore, for all $k\ge 1$ $$\sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i) | \geq|d(x,x_{n_{k}}) - d(y,x_{n_{k}}) | \ge d(y,x_{n_k}) -d(x,x_{n_k}).\tag1 $$ And by triangle inequality $$d(x,y)\le d(x,x_{n_k})+ d(x_{n_k},y)\implies d(y,x_{n_k})\ge d(x,y) - d(x,x_{n_k}) \tag2 $$ Combining $(1)$ and $(2)$ together with the fact that $-d(x,x_{n_k})\ge -1/k$, we find $$\sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i) | \ge d(y,x) -2d(x,x_{n_k})\ge d(y,x) -2/k, $$ and since this holds for any $k\ge1$, the desired inequality follows by letting $k\to\infty$.
To show that $d(x,y) \ge \sup_{i \in \mathbb{N}} |d(x,x_i) - d(y,x_i)|$, apply the following
to some well chosen $z$ (make sure to prove the above inequality yourself if you didn't already know it).