Someone told me that exchange is not safe because exchange can be hacked by hackers.
That's right. You should avoid any custodial service for holding your bitcoin.
In addition to the possibility of getting hacked, custodial services like exchanges can freeze your fund for any reason. You should use non-custodial wallet, so that you have full control over your fund.
I am using software wallet called 'electrum'. I downloaded it from the official website 'electrum.org'
Electrum is a trust worthy open-source wallet. The code has been reviewed by many people and no vulnarivty has been reported.
But take note that any online device is prone to hacking.