[W]hy did programmers ever write their programs on punch cards? Didn't computer screens and keyboards already exist by the time programmers used them?
We use whatever i/o mechanism our computers have. In the 1960s, paper tape was common. In the 1970s (when I started programming), paper tape was being replaced by punched cards.
Yes, there were machines with teletypes, and also astonishing things called VDUs. But they were not in the mainstream yet. Both of these technologies were more commonly used by the (mainframe) computer operators; rarely for us.
At the peak of the punch-card era, the most common machine was the IBM029
In that image, students are punching in their own code. Professional programmers more commonly wrote their code by hand on coding sheets, formatted according to the language you were coding in.
We would send our coding sheets off to the data center, where operators would punch them in (at blinding speeds), and then pass the cards to the verify operator. She (90% of data center staff were women; only their managers were male) would type your code again, with the punch machine set to verify mode. The machine would ding if what she was typing was different from what was on the card already. By doing it twice, they achieved speed and accuracy.
When you got your cards back, the first thing you would do was draw a diagonal line across the top of the entire deck. Woe betides if you dropped your cards before doing that! With the line drawn you had a fighting chance of getting your cards back in order after dropping them.
A lot of program editing consisted of inserting new cards, which we would usually punch ourselves, and moving existing cards to another place in the deck. Obviously, the diagonal line you draw originally would now be less useful, so after a few edits, you would draw another line. When the cards were getting too many lines or were starting to produce read errors on the card reader (the fastest readers worked at 1200 cards per minute and higher, so cards took a pounding each time they were read), you would send your deck back to the data center to be duplicated.
Small edits could be performed using a hand punch.
With experience, you would learn the Hollerith code for each character and could punch as fast as using a keyboard.
If no one senior was watching when you made an error, you could fill the wrong hole with a "chad" that had been punched out of the card, rubbing it with your thumbnail so that its edges meshed with the rest of the card. Such patches often came loose during the read process, but they often worked at least once. If the chad came out during the read process it would cause a "crash", and the following card(s) would be crushed and crumpled beyond recognition. The card reader would be jolted out of alignment, requiring a Computer Engineer to come and fix it.
In the late 1970's it become more common to load your program to magnetic tape. The tape held your code in fixed-length 80 character records, and we had "librarian" programs to do the editing. As I recall one was actually called Librarian. You would code another card deck to do the editing, or as was becoming more common, use a teletype or VDU to do your editing online. Wow!
The syntax used to drive those librarian editors was very much like the IBM-PC Edlin syntax.
In summary, we use what tools we have available. The newest technology is always the most expensive, and it can take a while before everyone has access to it. It's also a matter of convenience and skills. I am typing this on my laptop, but when writing an email on my smartphone, I use "Swype" input, where my finger makes a weird zigzag pattern over a keyboard image and the software works out what word I intend.
Good luck with your essay.