STRING_AGG Not Recognized on V15.0.2 of SQL Server LocalDB
Per my comments: Have you tried to use the STRING_AGG() function with a very simple test case to confirm it's an issue with the function and not your syntax in your main query?
It seems your syntax was not formatted properly, rather than the STRING_AGG() function not being available on your instance version.