instructs SQL Server that you only want to return one record, so your query is doing exactly what you've asked it to do.
Based on your description, you want something like:
WITH cte As
ROW_NUMBER() OVER (PARTITION BY Id2 ORDER BY [dateTime] DESC) As RN
INSERT INTO table2
RN = 1
; ROW_NUMBER (Transact-SQL) - SQL Server | Microsoft Docs