add a script for writing statistics