Your Mac might be caught in this Yahoo search loop that is probably a virus or malware entering the system. Now, there could be a lot of reasons for this. But the reason for such a virus could be because of ads and software causing this issue that you might be unaware of at the moment. The best way to get rid of this is simply removing any new software you have used or scanning for viruses.