SQL Agent Job or SQL Alert for Long Running Queries
You can't use the INTO keyword inside of an IF clause, so the syntax error you're currently getting is due to trying to insert the results into a temp table as part of the IF clause.
There's no performance benefit stuffing the query inside the IF clause, so for better readability I would run the query first then check the if results exist like so:
-- Get any long running queries
DROP TABLE IF EXISTS #LongRunningQuery
SELECT
    'SPID='+CONVERT(VARCHAR,a.session_id)+' has been running the following for '+CONVERT(VARCHAR,DATEDIFF(SS, a.start_time, CURRENT_TIMESTAMP))+' seconds: '+convert(varchar,b.text) AS EmailBody, 
    CONVERT(VARCHAR,DATEDIFF(SS, a.start_time, CURRENT_TIMESTAMP)) AS Runtime
INTO #LongRunningQuery
FROM sys.dm_exec_requests a
CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) b
WHERE a.status &lt;&gt; 'background'
    AND DATEDIFF(SS, a.start_time, CURRENT_TIMESTAMP) &gt; 60

-- Send email when long run queries found
IF EXISTS (SELECT 1 FROM #LongRunningQuery)
BEGIN

    EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Test Alerts', @recipients = 'test@test.com', @subject = 'Warning', @query = 'select * from #LongRunningQuery'
    
END