What version of sed are you using in the boot image?
Tested this command on ubuntu:
sed -i "s/^value3=.*/value3=$cust_attr_1/" "$varFile"
The output is correct with a newline and value4=.
When i run the script from within the boot image after deployment.
This is the file before:
This is the file after: