new function for writing classifications to file