Make cron wait for the child process

I am trying to find a list of files and writing it to a text file. Based on the machine performance the file writing will be slow at certain time.

The code to find file and redirecting the output to text file is on a shell script

/usr/bin/find  $SEARCH_DIR  -daystart \( \( -name 'KI*' -a -name '*.csv' \) -o  -name '*_xyz_*' \)  -mtime $DAYS_AGO -printf %f -printf "\n" | sort -r > File.txt

When the script is run manually thats fine. If I run in cron, how do I make it wait to finish the writing of file.txt ?

why do you wait to write file.txt?
instead of may you mail to yourself with contenst of the file.txt
in next cron work time is refreshes file.txt (overwrite file.txt) and you look the new mail for new informations

 
/usr/bin/find  $SEARCH_DIR  -daystart ..... sort -r | mail -s "Find Results" root 

The problem is find is not writing all the files to files.txt. And the files.txt is needed for further processing.

so files.txt is consisting and the find's result is half in txt only when the find works in cron?

what is the value of `$SEARCH_DIR` ?

Maybe write to file_temp.txt and rename the file to the correct name when you have finished. Assuming that the next stage is in another cron that stage will need code to wait until the file is available.