nth-element with output file