only update the needed line instead of rewriting the whole file

Signed-off-by: Victor Vieux <vieux@docker.com>