This saves only lines which underwent substitution, which was probably not what you wanted.
sed -n 's/old/new/;w file.tmp' file
It also requires a space after the w command.
This saves only lines which underwent substitution, which was probably not what you wanted.