I am asked to find a continuous, not polynomial function so that $\max|f(x)|=1$ for $0\leq x \leq 1$ and $\max|f(x)|$ is as big as we want for $1\leq x \leq 2$. I've come up with
$$ f(x) = \left\{\begin{array}{lr} \frac{\cos(x)}{2}, & \text{for } x=0\\ \frac{1}{2-x}, & \text{for } 0< x\leq 2 \end{array}\right\} $$ Which is not very clever, what are some other examples of these kind of functions?
Your your proposed function doesn't work, since it's not defined at $x=2$.
Here's one that works . . .
Fix $M > 0$, and let $f$ be defined by $$ f(x)= \begin{cases} \sin(2\pi x)&\text{if $0\le x\le 1$}\\[4pt] M\sin(2\pi (x-1))&\text{if $1< x\le 2$}\\ \end{cases} $$ Notes:
The function $f$ above is not unbounded, but it's not possible for a continuous function on $[0,2]$ to be unbounded.
However on $[0,1]$, the maximum absolute value of $f$ is $1$, and on $[1,2]$, the maximum absolute value of $f$ is $M$, which can be made arbitrarily large.
The continuity of $f$ is verified since both pieces "join" at $x=1$.