Proof (uniqueness of isomorphisms between well-orders)
Prove by induction that $f(x) = g(x)$ for all $x\in X$.
Suppose not, so there exists some $x\in X$ such that $f(x) \neq g(x)$ but $f|_{\op{pred}(x)} = g|_{\op{pred}(x)}$. WLOG by linearity, suppose $f(x) < g(x)$.
Since $B$ is an initial segment and $g(x)\in B$, we have $f(x) \in B$. As $g$ is surjective, there exists $x'\in X$ such that $g(x') = f(x)$, so $g(x') < g(x)$. Since $g$ is an isomorphism, $x'<x$, so by induction hypothesis $f(x') = g(x')$. But then $f(x') = f(x)$, which contradicts injectivity.