I was reading about Cook's Theorem for Turing machine. In its proof, it is said that the Turing machine would take at most $n^k$ steps (where $k$ is an integer and $k > 0$) to compute an input of length $n$.
This is probably assuming that the Turing machine does halt for the given input. It further says that we as there are at most $n^k$ steps, we don't need an infinite tape. A tape with $n^k$ elements is sufficient as the turning machine would not travel more than that.
Why do we say the Turing Machine needs at most $n^k$ steps?