A lot of your script is missing so I've had to make some assumptions, but here you go:
 Code:
$headerline = ""

Open (2, $TransactLog, 5)
While $CutoverLog <> "" and @Error = 0
	Open (1, $pcclist + $CutoverLog + "\" + $CutoverLog + "_Details_" + $year + $month + ".csv")

	$Line=Readline(1)
	If $headerline=""
		$headerline="done"
		Gosub WriteLog
	Endif
	
	$Line=Readline(1)
	While @ERROR=0
		Gosub WriteLog
		$Line=Readline(1)
	Loop
	
	Close(1)
	
	Del $CutoverLog
	
	$CutoverLog = Dir()
Loop
Close (2)


You really need to get rid of the GOSUB, add error checking to the OPENs, user FreeFileHandle() for the handles and a host of other code cleanups, but the above should get you started.