The code looks fine. Are you sure there’s something in the file you’re trying to print? Maybe you had something typed in an editor buffer but not saved it yet?
Yes, common mistake on this is not saving the files in your editor. It’ll look like you typed the text in but until you actually save it they aren’t on the disk. You can check this with the command:
cat test_ex20.txt
If that prints out nothing then it’s not been saved.