Hi @book-3,
Welcome to our community! 
Your solution is perfectly fine. To be honest, I don’t know which approach is better. The idea behind using GetKey is to ensure that user input does not get missed during one frame, but I never encountered a case where a released key was missed by Unity.
Pressing a key down could be missed due to key ghosting, which is an unsolveable hardware problem. (Unsolveable for us as game developers because we cannot control what hardware our future players use.)
Feel free to use your solution. If an issue occurs due to it, regard it as a valuable opportunity to learn something about user input. Making “mistakes” is the best way to learn more about a system because the interesting details often cannot be found in a manual.
I hope this helped a bit. 
See also:
- Forum User Guides : How to mark a topic as solved