saving training data to training.json or provided file in argument