Hey Rishita, Gokarna has emerged as a top choice among solo female travellers in recent years. I have gone there alone twice too. From my personal experience, my advise would be to visit Gokarna when the season is good. The first time I went there, it was the off-season and the whole town was pretty empty. It was unnerving but I was fine. I also recommend carrying enough cash because the ATMs are only in the main town area and payments mostly rely on cash. Hence, it's wise to have a little bit extra so that you can spend your days at the beach without having to go to the market repeatedly to withdraw.
Do read up other travellers' experiences. Research is important for a solo trip! You will feel confident yourself then :) Attaching a few of the best stories on Tripoto below. Hope this helped!