In Bash the value of an unquoted variable (e.g. ${repo} or $repo) undergoes word splitting and filename generation. This means in general an unquoted variable can generate more than one word. Or less; if it's unset or empty then it will generate zero words.
In case of a redirection like > ${repo} or > $repo, any number of words but one is wrong. Technically the following might be valid (but it's not):
# wrong
foo='bar baz'
echo qux > $foo
If it was valid, then the last line would be equivalent to
echo qux > bar baz
which is valid and equivalent to
echo qux baz > bar
Hiding an argument (here: baz) inside what looks like redirection (here: > $foo) would be a bad practice if done deliberately, or a potentially harmful bug if done inadvertently. Bash does not let you do this.
(Actually I suspect it's not really because Bash cares, but because of how its parser works: I think it recognizes redirections early, separates them from the actual command and processes as somewhat disconnected. Injecting an argument back into the command would be troublesome and not worth the hassle. But this is my guess.)
The manual states explicitly [emphasis mine]:
The word following the redirection operator […], unless otherwise noted, is subjected to brace expansion, tilde expansion, parameter expansion, command substitution, arithmetic expansion, quote removal, filename expansion, and word splitting. If it expands to more than one word, Bash reports an error.
This is the "ambiguous redirect" error you got. The manual says "more than one word"; tests indicate the same error occurs in a case of "zero words" (the variable empty or unset).
The right number of words is one. This also applies when there are many variables involved, like in your /etc/local/borg-lastrun-${repo}-${tobackup}.txt. This string cannot expand to zero words, but (depending on the values of the variables) it can expand to more than one word. A right way to make sure the string is interpreted as a single word is to double-quote it:
… > "/etc/local/borg-lastrun-${repo}-${tobackup}.txt"
Double-quoting is almost always the right thing to do also in other parts of code, wherever you use variables. There are situations where you may omit quotes. Situations where you shouldn't quote are relatively rare.
Single-quoting is another way to prevent word splitting, but since it also prevents variable expansion (in fact: any expansion), it's not useful in our case at all.