Bash: using SED, trying to replace some characters except first or last line

Hi,
I require to replace 2 items:

  1. replace start of all lines in a file with ' except the first line
  2. replace end of all lines in a file with '||chr( except last line

I am able to do the entire file using
sed -e s/^/\'/g -e s/$/\'\|\|chr\(/g "$file" > newfile.txt

but am not yet able to incorporate the EXCEPT conditions as stated above. I have searched through the forums, but couldn't arrive at the expected output

Thanks !