I don’t think you wasted money on the phone, as we don’t have other Moto G5S users telling us their keyboards keep disappearing. My daughter uses the same phone and has never mentioned such a thing.
I also don’t think you’d need to keep wasting time with it over and over, (which no one would want to do) if we can help you solve it once and for all. But in order to do that, we’d need to work with you, together, to understand what you’ve tried and what might be going on.
For instance, earlier I asked some questions, but I don’t see your answers. Here’s what I asked:
Does the keyboard ever come up in any app? Are you sure you have a keyboard app installed and enabled?
For example, could this be the problem?
You did write:
What keyboard did you install? Are you using Gboard?