str := '1';
str := QuotedStr(str);
copy from debug --> str = '''1'''
1st line: str is a string. The value of the string variable must be enclosed by single quotes in the source code. And that's also the way the debugger displays it: '1'. But when you do a WriteLn the quotes are not displayed: WriteLn(str) --> 1. A special case is a string which already contains a single quote character: to avoid confusion with the string-identifying quotes this character then is doubled. Example: WriteLn('It''s magic') ---> It's magic.
2nd line: QuotedStr(str) -> the function Quotedstr has the purpose to enclose the result string in single quotes (but only when the string does not begin/end with a quote already). Therefore the result of QuotedStr('1') is displayed by the debugger as '''1''': the first and last quotes are the leading and trailing quotes identifying the output as a string; the remaining quotes are the quotes added by the QuotedStr function - they are doubled because they are inside the string.
If you want to have double quotes around the input string you can use the function AnsiQuotedStr which allows a second parameter for the quoting character:
str := '1' --> AnsiQuotedStr('1', '"') --> '"1"' in the debugger, or "1" in WriteLn.