From your text I get the impression you are concerned only with the final file and not the 9,999 intermediate ones, and from that it doesn't seem that you are appending to existing output files as your example suggests, but are creating new intermediate files to be used only for the next input. If I assume correctly then this should work:
input=input1.bed
for (( i = 0; i < 10000; i++ ))
do
c-random-script -i $input -g g19 -e DB >output
mv output last_output
input=last_output
done
mv last_output final-desired-name
The speed will depend completely on the time it takes "random script" to execute 10K times.
# I need to run this 10k times by using same input to get final 10k outputs i.e outputY1 to outputY10000
# Then output a table having 4th column and 10th column in a file named stats.txt and calculate mean and standard deviation of 7th column 0f 10k outputY* files
seq 1 10000 |while read line
do
c-randomnumbers-script -i input1.bed -g g19 -e DB >> outputX${line}
intesect-script -a outputX${line} -b input2.bed -wa -wa -f1 |awk '!a[$4]++ {print $1, $2, $3, $4, $5, $6, $10}' OFS="\t" >> outputY${line};
rm outputX${line}
done
You need explain the second rules more detail, I don't see 10th column in your sample stats.txt
Then output a table having 4th column and 10th column in a file named stats.txt and calculate mean and standard deviation of 7th column 0f 10k outputY* files