Consider a picewise continuous function $f:[a,b] \to \mathbb{R}$, i.e there are $a=t_0<\dots <t_n=b$ such that $f$ is continuous on each open interval $(t_i,t_{i+1})$ and the limits $\lim\limits_{x \uparrow t_i}f(x)$ and $\lim\limits_{x \downarrow t_i}f(x)$ exists for all $i=1,\dots,n$.
Why does there exist a constant $M>0$ such that $|f(x)| \leq M$ for all $x \in [a,b]$?
The extreme value theorem tells us that if $f$ is continuous on a closed and bounded interval, then it is bounded (and that it achieves these bounds as well).
Let us see how we can apply that your case. Let $i \in \{0, \ldots, n-1\}$ and consider the function $g_i$ defined on $[t_{i}, t_{i+1}]$ as follows: $$g_i(t) := \begin{cases}f(t) & t \in (t_i, t_{i+1})\\\displaystyle\lim_{x\to t_i^+}f(x) & t = t_i\\\displaystyle\lim_{x\to t_{i+1}^-}f(x) & t = t_{i+1}\\\end{cases}$$
It is an easy check that $g_i$ is continuous on $[t_i, t_{i+1}]$. Thus, there exists $M_i$ such that $|g_i(x)| \le M_i$ for all $x \in [t_i, t_{i+1}]$.
In turn, this gives us that $|f(x)| \le M_i$ for all $x \in (t_i, t_{i+1})$.
Now, to conclude, we simply choose $$M = \max\{M_0, \ldots, M_{n-1}, |f(t_0)|, \ldots, |f(t_n)|\}.$$
It is easy to see that $$|f(x)| \le M \qquad \forall \; x \in [a, b].$$