k-NN print to file