Sharks are pretty far down on the list of things to worry about when learning to surf. They really won't bother you unless they mistake you for something they are actually interested in. There are a few rules of thumb like, don't wear anything metal/shiny, avoind surfing in the early morning/later evening when they feed and try to avoid murky water and areas where there are a lot of bait fish a shark might want to eat. Aslo, when starting out surf near a lifeguard especially if you are not a stong swimmer and don't surf alone.
Classes are nice and it is good to have someone who knows what they are doing to keep you from getting into bad habits but like most things you can learn on your own. Putting your money into a decent board would be a better use of your money if you can only afford one or the other. Though start out with a beginers board maybe even a foam board. You can get an 8'-9' softtop for at or under 200 bucks at Ron Jon or a 8' Wavestorm from Costco/Amazon for that price. There are better softtops out there but the price goes up. You can try Craigslist or facebook marketplace but beware soft boards that have baked in somone garge for the last 5 years.
Most importanly just have fun and enjoy your time on the water.