I'm trying to solve the exercise 4.2.4 of the book of Viana and Oliveira, the statement follows:
Exercise 4.2.4: Let $X$ be a finite set and $\Sigma = X^{\mathbb{N}}$. Prove that every infinite compact subset of $\Sigma$ invariant under the shift map $\sigma \colon \Sigma \to \Sigma$ contains some non-periodic point.
There is a hint in the portuguese version of the book which is: Consider $K$ invariant compact set as above. We can take a sequence of periodic orbits $\{\mathcal{O}_n\}$ in $K$ such that the period goes to infinity as $n \to \infty$. Consider $Y \subset K$ the set of accumulation points of this sequence, show that $Y$ cannot be only one point. Then, one can take two periodic points $p \neq q$ in $Y$ and take $z$ a heteroclinic point, show that $z \in Y$ and conclude the exercise.
The unique step that I understand (actually, not very well) is that we can assume that $K$ contain some sequence of periodic points with periods going to infinity.