The comment by kos is correct, this is more or less answered at Auto confirm when running bash scripts.
Serg has the right idea forget about passing a carriage return and just pass -y to add-apt-repository. Just use his answer.
-y, --yes Assume yes to all queries
So your script would look like such;
#!/bin/bash
add-apt-repository -y ppa:yannubuntu/boot-repair
add-apt-repository -y ppa:libreoffice/libreoffice-5-1
Carriage Returns from Shell
Just to clarify how to send a carriage return from a script, there are a lot of options actually.
You could use the yes command which was built to output y along with a newline or an optional argument with newline. Thus, yes with no argument is a carriage return. You can pass a carriage return in a script with the commands from your example;
#!/bin/bash
yes '' | add-apt-repository ppa:yannubuntu/boot-repair
yes '' | add-apt-repository ppa:libreoffice/libreoffice-5-1
I think echo would work too actually if it's passing a new line, again from your example;
#!/bin/bash
echo | add-apt-repository ppa:yannubuntu/boot-repair
echo | add-apt-repository ppa:libreoffice/libreoffice-5-1
Or for more complicated variations you could use expect even.