See my earlier post. I took another look and I understand the problem better. I haven't troubleshot that but I will leave that up to you to determine how the user input ends up in the array 4 times. There is nothing wrong with the contents of the for loop.
I'd suggest that if you really want to improve things, use std::string with getline. The user input could easily overrun the destination arrays causing undefined behavior.
Oh I get it. You are appending to the files. Therefore if you run the program multiple times the data keeps being added to the file. So if you are running the program over and over you could end up seeing duplicate output due to the same information being added over and over. Again it has nothing to do with the if..else..if statements in the search function.
so.. i found out what the real problem is. i thought that after doing first or second if the search jumps to the third if but actualy after doing first or second if it runs the for again, thus doing the third if and i get both solutions. if i added 2-3 more ifs that matched the search_word it would, after every if matb]ched, jump again to the for until there aren't any other ifs matching the search_word.