invoke-sqlcmd gives problem

Objective :  Trying to backup the SQL*Server Database using INVOKE-SQLCMD in powershell

How the Invoke-SQLCMD called  : 
invoke-sqlcmd -InputFile  $DBSCRIPTFILE  -ServerInstance $INSTSERVER  -Username $uid -Password $pwd  3>&1 2>&1 > $OUTFILE

Name of the Powershell script : MS_SQLServer_Backup.ps1 (Copied below)

Name of the SQL script : backup_mssql_dbs.SQL  (Copied below)

Name of the log file : backup_output.log (Copied below)

MS_SQLServer_Backup.ps1

Set-executionpolicy unrestricted
set-location F:\dba\bin
#$DBSCRIPTFILE="F:\dba\bin\backup_mssql_dbs.sql"
$DBSCRIPTFILE="backup_mssql_dbs.sql"
$uid="sa"
$pwd="XXXXXXXXXXXXXXXX"
$INSTSERVER="XXXX\XXXXXX"
$OUTFILE="F:\dba\logs\backup_output.txt"
$error_cnt=0

invoke-sqlcmd -InputFile  $DBSCRIPTFILE  -ServerInstance $INSTSERVER  -Username $uid -Password $pwd  3>&1 2>&1 > $OUTFILE

backup_mssql_dbs.SQL

DECLARE @name VARCHAR(50) -- database name 
DECLARE @rec_model tinyint
DECLARE @path VARCHAR(256) -- path for backup files 
DECLARE @fileName VARCHAR(256) -- filename for backup 
DECLARE @LogName VARCHAR(256) -- filename for Log backup
DECLARE @fileDate VARCHAR(20) -- used for file name


SET @path = 'F:\MSSQL\Backup' 
 
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112)
 
DECLARE db_cursor CURSOR READ_ONLY FOR 
SELECT name , recovery_model
FROM sys.databases where state <> 6

OPEN db_cursor  
FETCH NEXT FROM db_cursor INTO @name , @rec_model

WHILE @@FETCH_STATUS = 0  
BEGIN  
   SET @fileName = @path +'\'+ @name + '\'+'FULL'+'\'+@name+'_' + @fileDate + '.BAK'
   SET @LogName = @path +'\'+ @name + '\'+'FULL'+'\'+@name+'_' + @fileDate + '.LBK'
   BACKUP DATABASE @name TO DISK = @fileName  WITH RETAINDAYS = 1

   IF ( @rec_model = 1 )
   BEGIN
          BACKUP LOG @name TO DISK = @LogName
   END
   FETCH NEXT FROM db_cursor INTO @name  , @rec_model
END 

CLOSE db_cursor
DEALLOCATE db_cursor

backup_output.log

Processed 320 pages for database 'model', file 'modeldev' on file 3.
Processed 2 pages for database 'model', file 'modellog' on file 3.
BACKUP DATABASE successfully processed 322 pages in 0.085 seconds (29.509 MB/sec).
Processed 2400 pages for database 'msdb', file 'MSDBData' on file 3.
Processed 4 pages for database 'msdb', file 'MSDBLog' on file 3.
BACKUP DATABASE successfully processed 2404 pages in 0.639 seconds (29.390 MB/sec).
Processed 17104 pages for database 'blablabla', file 'blablabla' on file 3.
Processed 2 pages for database 'blablabla', file 'blablabla_log' on file 3.
BACKUP DATABASE successfully processed 17106 pages in 3.394 seconds (39.373 MB/sec).
At F:\dba\bin\MS_SQLServer_Backup.ps1:11 char:1
+ invoke-sqlcmd -InputFile  $DBSCRIPTFILE  -ServerInstance $INSTSERVER  -Username  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
    + FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand