Using environment variable and end-of-line pattern at the same time.

# Use backslash for end-of-line $ pattern, and double quotes for expressing the variable
sed -e "\$s/\$/\n+--$3-----+/"
click the source code to copy