Question: I would like to be able to play a piano or keyboard and have what I play stored and reproduced as musical notation. Is that possible?

Answer: 
Any keyboard that is MIDI capable can be plugged into a computer running notation software.

Although we don't offer recommendations for specific products here, just know that most electronic keyboards support MIDI, and most notation software supports converting what you play into sheet music.
This is very feasible, and has been for a long time. You need three things:

1. First a keyboard that captures the pressing down of keys. Today you would probably select a midi keyboard with USB connection. You may check this website to get an overview what is available in the market. [Example of large webshop to get an overview of what is available, not a recommendation](https://www.thomann.de/se/midi_masterkeyboards.html)
2. Secondly you need a computer. Most computers made the last ten years or even more will do. (And mouse, screen). Internet connection helps.
3. The third part is a program that can do the translation. All of the three "professional" programs does this (Finale, Sibelius, Dorico). At least one of them has a free version (Dorico SE) which you simply download.The free program Musescore is another example that can do it. There are quite a few other programs available that can do similar things, almost all so called DAW-s can do it. (And I have probably forgotten a dozen or more programs).

My general experience is that it can take a bit of work to create a good looking score from my fumbling on the keyboard, but that is me.