writing with proper line numbers for diff