I repeat, safety should comes first, if you are a beginner, start saving up for a secured open source hardware wallet now, we are heading into 2024, add this up to your plans if you don't have the money now, the safety of your Bitcoin is what will count in the end, not how much you have accumulated and lost.
First of all, as Cantsay said, you didn't lose your coins because you didn't invest in a hardware wallet, but because of some stupid thing you did that you shouldn't have done. Whether you exposed your private keys and put them somewhere you shouldn't have, or your device was infected with malware because you didn't take the necessary precautions to protect it, or something else, it doesn't matter.
When it comes to storing cryptocurrency, hardware wallets can seem like the safest option for beginners. They're convenient plug-and-play devices that handle your private keys and sign transactions without exposing sensitive data to your everyday computer. However, at the end of the day, they're still computers running software and if that software has vulnerabilities or the user isn't careful, funds can still be compromised.
I dont think hardware wallets are inherently more secure than properly-implemented cold storage solutions. In fact, as closed-source devices, they can be considered black boxes - we can't fully verify what's happening under the hood. (Take Ledger wallets as one very bad example.)
No system is perfectly foolproof especially with uncareful users. If people type their recovery phrase into phishing sites or malware-infected devices, hackers can steal keys and bypass any storage protections. The hardware wallet itself does nothing to prevent that.
So while hardware wallets are easy to use securely for beginners, ultimately the user is still responsible for guarding credentials and verifying transactions. Their convenience doesn't outweigh proper opsec procedures.