If the monkeys were truly infinite would time even matter? For any set of monkeys that could write Hamlet within a year there’s an infinite number of duplicate sets, so they could do as much writing in one day as the original set would do over the age of the universe.
There aren’t an infinite arrangements of keystrokes that are the length of Hamlet and aren’t Hamlet. Hamlet is 191,726 characters long, it’s like guessing a password.
44 keys on a typewriter, 191726 characters, makes 44^191726 or about 4.054 × 10^315094 combinations.