The following question is similar to this one:
Determine all meromorphic functions $f \colon \Bbb C \to \Bbb C$ that $$ \vert f(z) \vert = 1 \qquad \forall z \colon \vert z \vert = 1. $$
Unfortunately I have no idea to tackle this. Sorry for insufficient background.
I guess the Blaschke products would also needed in this question, but the poles and zeros are not "confined", and then the situation might be subtle. Anyway, thanks in advance for any comments and ideas.
Note that if $f$ has no zeroes or poles inside the unit circle, $f=\lambda, |\lambda|=1$ by applying the maximum modulus to $f, \frac{1}{f}$.
So let the finite number of zeroes inside the unit disc be $z_1,..z_k$ and the finite number of poles inside the unit disc be $w_1,..w_m$ (all counted with multiplicities so some $z$'s or $w$'s can be equal in between but $z_j \ne w_l$ and either set can be empty - note that $f$ meromorphic means that there are finitely many zeroes and poles within any compact set since the function is not identical zero or infinity given that $|f|=1$ on the unit circle)
But now if $B(z)=\Pi{\frac{z-z_j}{1-\bar z_j z}}$ is the corresponding Blaschke product for zeroes and $B_1(z)=\Pi{\frac{z-w_j}{1-\bar w_j z}}$ is the corresponding Blaschke product for poles (taken as $1$ if the respective set is empty), $|B|=|B_1|=1$ on the unit circle and by construction:
$g(z)=\frac{f(z)B_1(z)}{B(z)}$ is analytic inside the unit disc and has no zeroes as $B$ eliminates them and no poles since $B_1$ eliminates them, while preserving the fact that $|g|=1$ on the unit circle. Hence $g=\lambda$ constant of unit modulus and putting all together:
$f(z)=\lambda\Pi_{1 \le j \le k}{\frac{z-z_j}{1-\bar z_j z}}\Pi_{1 \le l \le m}{\frac{1-\bar w_l z}{z-w_l}}$, where $|\lambda|=1, k,m \ge 0, |z_1|,..|z_k| < 1, |w_1|, ...|w_m| <1, z_j \ne w_l$ but otherwise all arbitrary with the given conditions (so some $z$'s can be equal and same with $w$'s while the respective factors are $1$ if $k=0$ or $m=0$)