The whole reason there is an AI here is because a markov chain, which is what you are describing, doesn't work beyond one or two word horizons.
Not to mention that it doesn't just select which word it thinks is MOST probable, because that has been shown to lead to stilted and awkward output. Instead it randomly selects from the top few thousand possible words with probability based on the model's estimation