HASHBYTES() yields different results for nvarchar variable AND its value

Could someone assist me with this issue? I'm encountering discrepancies in values, where the output of an NVARCHAR variable displays one value, while the corresponding value in the SELECT statement appears to be different

DROP TABLE IF EXISTS #TableStructure
GO
DECLARE @TableName VARCHAR(30) = 'MARA', @Tablecolumn NVARCHAR(30)= ''
, @Datatype NVARCHAR(30) = '', @AllFieldChkSum NVARCHAR(MAX) = '', @SQL NVARCHAR(MAX) = ''

SELECT COLUMN_NAME, ORDINAL_POSITION, Data_TYPE AS DT, 0 AS Done
INTO #TableStructure
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
AND COLUMN_NAME NOT IN ('LastModified', 'zCHeckSum', 'zAllCheckSum', 'zCheckSumINCR')
AND COLUMN_NAME IN ('MATNR')

WHILE (SELECT TOP 1 1 FROM #TableStructure WHERE Done = 0 ORDER BY ORDINAL_POSITION) = 1
BEGIN
SELECT TOP 1 @Tablecolumn = COLUMN_NAME, @Datatype = DT FROM #TableStructure WHERE Done = 0;

   SET @AllFieldChkSum = @AllFieldChkSum + CASE WHEN @Datatype IN ('VARCHAR','NVARCHAR') 
                                                                            THEN ', CAST(ISNULL('      + @Tablecolumn + ','''') AS NVARCHAR)'
                                                                            WHEN @Datatype IN ('DECIMAL', 'NUMERIC')
                                                                            THEN ', CAST(ISNULL('      + @Tablecolumn + ',0) AS NVARCHAR)'
                                                                      END;
   UPDATE #TableStructure SET Done = 1 WHERE COLUMN_NAME = @Tablecolumn;

END

SET @AllFieldChkSum = dgdb.dbo.RegexReplace(@AllFieldChkSum,'^, |, $','')
SET @AllFieldChkSum = REPLACE(@AllFieldChkSum,'),',')+')

SELECT @AllFieldChkSum

SELECT HASHBYTES('SHA2_256', @AllFieldChkSum ) as Variable, HASHBYTES('SHA2_256', CAST(ISNULL(MATNR,'') AS NVARCHAR)) WithoutVaraible
FROM MARA WITH (NOLOCK)
WHERE MATNR = 'N10-PAC1-550W'

--output