The error occurs because the first parameter of your string.Format
already has curly braces to denote the function. You must escape the braces similar to what you did to the quotes:
xmlWriter.WriteRaw(string.Format(@" $(document).ready(function (){{ $("".fill-div"").attr(""href"",""{0}"");}});", backUrl));