write file for cast data