cosine to output.txt