Let $|\psi_1 \rangle, \dots, |\psi_n \rangle, |\phi_1 \rangle, \dots, |\phi_n\rangle \in \mathbb{C}^m$. Show that if $\langle \psi_i | \psi_j \rangle = \langle \phi_i | \phi_j \rangle$, then there always exists a unitary $U$ such that $U|\psi_i\rangle = |\phi_i \rangle$.
If $n = m$ and $|\psi_i\rangle$ and $|\phi_i\rangle$ form a basis for $\mathbb{C}^m$, then, the problem is simple since it just amounts to a change of basis. What about the general case?
$\left| \psi_1\right>, \left|\psi_2\right>,..,\left|\psi_n \right>$ need not to be a basis if $n=m$. Let $V=<\left|\psi_1\right>, \left|\psi_2\right>,..,\left|\psi_n\right> >$; $U=<\left|\phi_1\right>, \left|\phi_2\right>,..,\left|\phi_n\right> >$.
Lemma
If $I\subseteq \{1,2,...,n\}$ is such that $\{\left|\psi_{i}\right>\}_{i \in I}$ is a basis of V, then $\{\left|\phi_{i}\right>\}_{i \in I}$ is a basis of U.
First, let's proof linear independence. Assume $v=\sum_{i \in I} a_i \phi_{i} = 0$. Thus $\left<v,v\right>=\sum_{i.j \in I} a_ia_j \left<\phi_i,\phi_j\right>=0$. But then, let $u=\sum_{i \in I} a_i \psi_{i}$. Then $\left<u,u\right>=\sum_{i.j \in I} a_ia_j \left<\psi_i,\psi_j\right> = \sum_{i.j \in I} a_ia_j \left<\phi_i,\phi_j\right> = \left<v,v\right> =0$. Thus, $a_i=0$, but then $v=0$
Second, let's proof it's spanning. Let $v \in U$. Then, $v=\sum_{i=1}^n a_i \phi_{i}$. Let $u=\sum_{i=1}^n a_i \psi_{i}$. Because the family is spanning set, $u=\sum_{j \in I} b_j \psi_{j}$. Let $w = \sum_{j \in I} b_j \phi_{j}$. Then $u-w=0$ because $\left<u-w,u-w\right>=0$ (same argument as above)
End of lemma.
If $dim(V)=dim(W)<m$, find a basis of $V$, which we may assume is $\left|\psi_1\right>, \left|\psi_2\right>,..,\left|\psi_l\right>$ (relabel both families of vectors the same way). Find ana orthonormal base of $V^\perp$, which we denote by $\left|\psi'_{l+1}\right>, ..., \left|\psi'_{m}\right>$ and also let $\left|\phi'_{l+1}\right>, ..., \left|\phi'_{m}\right>$ be an orthonormal base of $V^\perp$. Apply the case when $n=m$ to the new basis (old basis+basis of orthogonal complement).
If $dim(V)=dim(W)=m$, apply the usual theorem to the basis and check that everything goes well.