A colleague showed me a slightly different pattern that I tend to use for utility scripts. I've had to mock up the file names as I don't have xp_cmdshell enabled. You can do similar with XML PATH type constructs but I find this syntax easier to remember and control for the occasions I need this type of thing.
declare @SQL nvarchar(max);
declare @Database varchar(200) = 'dwts001'
declare @FileDirectory varchar(200) = 'E:\Transfer\TransactionLogs\'
declare @CRLF char(2) = char(13) + char(10);
with cteFileNames as
select top(100) 'test'+convert(varchar(10),base.fileNumber)+'.log' as transactionLog from
select top(100) ROW_NUMBER( ) over (ORDER BY table_name) as fileNumber from information_schema.columns
) as base
@SQL = isnull(@SQL+@CRLF,'') +
'RESTORE LOG ' + @Database + @CRLF +
'FROM DISK = N''' + @FileDirectory + transactionLog + '''' + @CRLF +
'WITH FILE = 1' + @CRLF +
', NORECOVERY' + @CRLF +
', NOUNLOAD' + @CRLF +
', STATS = 10;' + @CRLF +
'PRINT ''Restoring Transaction File: ' + transactionLog + ''';' + @CRLF +
'PRINT ''-- -- --'';' + @CRLF
-- NB Limit of printable characters characters