Expect scripting issue, works interactively when doing commands in cli, does not work in script

Hi; problem may be obvious, simple but I have to say it is somehow not easy to locate the issue.

I am doing some word extracting from multiline text.

Interacting in CLI seems to work without issues. First step is to add multiline text to a variable.

expect1.1>
expect1.1> set multilinetext "first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two"
first one two
second one two three
third one
fourth one two three four
fifth one two
expect1.2>

But I tried that inside script, no result, always getting error messages. Here are 5 attempts.

#!/bin/bash

expect -c "

set multilinetext \"first one two\\nsecond one two three\\nthird one\\nfourth one two three four\\nfifth one two\";
#     multilinetext=\"first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two\";
#     set multilinetext 'first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two';
#     set multilinetext \"first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two\";
#     set multilinetext "first one two\nsecond one two three\nthird one\nfourth one two three four\nfifth one two"

;"

Errors are from the:

wrong # args: should be "set varName ?newValue?"
    while executing

To the:

couldn't read file "one": no such file or directory

And this is just the first step. Have to ask if somebody has correct command and explanation.

Thank you.

Have you tried:

#!/bin/bash

expect -c "

set multilinetext 'first one two
second one two three
third one
fourth one two three four
fifth one two'

;"

?

Hi;
Thanks for replying, sorry for my delayed response.

cat test.sh
#!/bin/bash

expect -c "

set multilinetext 'first one two
second one two three
third one
fourth one two three four
fifth one two'

;"

Error:
 ./test.sh
wrong # args: should be "set varName ?newValue?"
    while executing
"set multilinetext 'first one two"

It looks that the "-c" commands calling parameter in bash, can create number of different errors.

I am now trying to separate all Expect from Bash - Expect dedicated files called from main bash files.

It seems to have lots of benefits, also some drawbacks.