Let $h: [0,1] \rightarrow \mathbb{R}$ be a continuous function such that $h(0) = h(1) =0$. Define $f$ on $[1,\infty)$ by \begin{align} f(n+x) = \begin{cases} \frac{1}{n} h(nx), &\quad 0 \leq x \leq \frac{1}{n}, \\ 0, &\quad \frac{1}{n} \leq x \leq 1 \end{cases} \end{align} for $n=1, 2, \ldots$.
I want to show $f$ is uniformly continuous on $[1,\infty)$.
First I am not sure $f(n+x)$ is defined on $[1,\infty)$. Note $\frac{1}{n} h(nx)$, is continuous on $(0,\frac{1}{n})$, and its extension $\bar{h}$ include $0,\frac{1}{n}$ is continuous due to $h(0)=h(1)=0$, so at lest I know, for $0\leq x \leq \frac{1}{n}$, $\bar{h}$ is uniformly continuous [continouos + compact domain], so $\frac{1}{n}h(nx)$ is uniformly continuous on $[0,\frac{1}{n}]$, and note that $0$ is uniformly continuous on $\frac{1}{n}\leq x \leq 1$ and hence union of two uniformly continuous fuction with non-empty intersectrion is uniformly continuous, so $f(n+x)$ is uniformly continuous on $[0,1]$.
Do I understand wrong? If so how one can solve the above problem?
First of all, I'm not sure if you understand the definition of $f$. When $n=1$, the definition tells you how to compute $f(1+x)$ for $0 \le x \le 1$; thus, it defines $f$ on $[1,2]$. The definition says that $f(1+x) = h(x)$, so the graph $f$ on $[1,2]$ is just a copy of the graph of $h$, shifted to the right by one unit. For $n=2$, the definition tells you how to compute $f(2+x)$ for $0 \le x \le 1$; thus, it defines $f$ on $[2,3]$. On $[2, 2.5]$, the graph of $f$ is a copy of the graph of $h$, shrunk by a factor of 2 (both vertically and horizontally). On $[2.5, 3]$, the value of $f$ is 0, so the graph lies along the $x$-axis. Similarly, for every $n$, the definition defines $f$ on $[n, n+1]$. The graph of $f$ on this interval consists of a copy of the graph of $h$, shrunk by a factor of $n$, followed by a line segment lying on the $x$-axis. The fact that $h(0) = h(1) = 0$ guarantees that these pieces fit together without any jumps where the definition switches from one case to the next.
Now, to prove uniform continuity: You have already cited the theorem that a continuous function on a compact domain is uniformly continuous. This implies that $f$ is uniformly continuous on $[1, N]$, for any positive integer $N$. The problem is how to deal with $[1, \infty)$.
A couple of suggestions:
Use the $\epsilon$-$\delta$ definition of uniform continuity.
Note that $h$ is bounded. You can use this to show that when $N$ is large, $f$ on $[N, N+1]$ is very close to 0.