Our opinions here are going to be based on limited information. I've worked with several buyer's through many years in both Mortgage and Real Estate and the advice is not uncommon. It may be due to not having enough established trade lines. Or it could be due to needing to re-establish credit after a tough time. In either case, getting a card and using it in a limited responsible fashion will initially reduce your score, but in short order improve it.
Only use the card for expenses you would normally pay cash for and then pay it off monthly, things like gas & groceries. Don't treat it like "extra money." When you see your checking account in better shape than you might be used to seeing it, avoid the temptation to splurge on something.
Credit is like a muscle, it must be used to grow but not abused so it won't be strained or damage. New credit, within reason will be useful and may be necessary to get your scores where you need them.
If you are afraid of being declined, start with your own bank or credit union and ask about a secured credit card. You keep money on deposit that allows them to give you the card. Your limit is tied to your deposit. Best of luck.