How to handle Not Found into CSV

Hi Folks
I am new to RPA. I am developing a system where a search is going to happen on a web page and the result will be stored in CSV. I have done all thing.The only issue i am facing is i am not able to process when data not found. So if any one of you could help me in that. It would be appreciated. Lets take an example on website we are searching for employees list using employee code and we need to put the employee detail into CSV. Now suppose one of employee code is not available in Database so we get the output as employee code does not exist. so Now i want to put this thing in CSV as well that Employee code Does not exist.
Any Idea How can we do that…?
Thanks In Advance