The problem seems to be incorrect SQL syntax from the datasource (not an issue with QuickSight) - that same query would give the same error if executed on postgresql directly. Try the query below:
WITH RECURSIVE Months AS
(
SELECT
CAST('01-01-2021' AS timestamp) AS MyDate
UNION ALL
SELECT
MyDate + interval '1 month'
FROM Months
WHERE MyDate <= CAST(NOW() AS DATE)
)
select MyDate from Months