writing a file for every stock in training