Consider the following statement
- Any continuous function $f$ on $[a,b]\subset \mathbb{R}$ is bounded.
I would like to validate the following proof:
Proof: For all $n>0$, there exists a real $x_n\in [0,1]$ such that $f(x_n)>n$. So $f(x_n)\rightarrow +\infty$. By Bolzano-Weierstrass theorem, there exists a convergent subsequence $(u_n)$ of $(x_n)$. Denote by $l\in [0,1]$ its limit.
Then, by continuity of $f$, $f(u_n)\rightarrow f(l)$ which is absurd because we have also $f(u_n)\rightarrow +\infty$.
Your argument is correct, all you need is to clarify at the beginning that you are assuming that $f$ is unbounded, and you need to deal with unboundedness "below".
It is preferable, though, to use the proof straight from the definition of compactness, without appeal to any theorem and valid in more general contexts: for each $x\in [a,b]$, by continuity there exists $\delta_x$ such that $|f(y)|<|f(x)|+1$ for all $y\in (x-\delta_x,x+\delta_x)$. Then $$ [a,b]\subset\bigcup_{x\in[a,b]}(x-\delta_x,x+\delta_x). $$ As $[a,b]$ is compact, there exist $x_1,\ldots,x_n\in[a,b]$ with $$ [a,b]\subset\bigcup_1^n(x_j-\delta_{x_j},x_j+\delta_{x_j}). $$ Now, given any $y\in [a,b]$, there exists $j$ with $y\in (x_j-\delta_{x_j},x_j+\delta_{x_j})$. So $$ |f(y)|<|f(x_j)|+1. $$ It follows that $$ |f(y)|<1+\max\{|f(x_1)|,\ldots,|f(x_n)|\},\ \ \ \ y\in [a,b]. $$