Let $(X_i)_{i\in I}$ be a family of subsets of $M$ such that $M=\bigcup_{i\in I}\mbox{int}X_i.$ If $f:M\rightarrow N$ is such that $f\vert X_i$ is continuous for each $i\in I$, then $f$ is continuous.
Attempt:
We take $a\in X_i$, $i\in I$, and $\epsilon>0$. Since the restriction is continuous, if we denote by $B=B(f(a);\epsilon)$, we have that $f^{-1}(B)$ is an open subset of $X_i$ which contains $a$. Therefore we conclude that $a\in \mbox{int}(X_i)$.
How to proceed from here in order to finalize the proof? I mean, how would this imply the continuity from the point of view of $f$?