sed: -e expression #1, char 19: unterminated `s' command
Sure the s command is s/<something>/<else>/ - there is a trailing /. Do:
sed -r 's/where /$line ;/'
^ - trailing /
The -r option seems unused - where has no extended regular expressions. If so, remove it.
Your command uses ' quotes, so $line is not expanded. Research the difference between single and double quotes in shell, most probably you meant to use " here.
Note that each loop > qWithWhere.cql is recreating result and overwriting the result from previous loop. You might just run the loop on the last line them.
Read how to read a file line by line in bash and how to Escape a string for a sed replace pattern .
The following code with a space after where in input:
cat <<EOF >input
capture 'data.csv'
select * from test where
capture off;
EOF
line="where Column11 in ('Value1','Value2','Vlaue3') and Column12 in ('Value11','Value22','Vlaue32')"
sed -r "s/where /where $line ;/" input
outputs:
capture 'data.csv'
select * from test where where Column11 in ('Value1','Value2','Vlaue3') and Column12 in ('Value11','Value22','Vlaue32') ;
capture off;