Unable to use multiple appendfile commands in Action Script

I am trying to manually set the Cit.properties file with the following settings using the following action script and it seems to only use the first “appendfile” command and ignore the last 2 appendfile commands. If I commented out “//” the first appendfile command, the only second appendfile command will work but ignore the last one.

How do I make it work with all appendfile commands before the move command?

// WINDOWS
if {((name of operating system) as lowercase) contains “win”}
// list of directories to compress
if {exists folder ((value of variable “windir” of environment) & “” & “cit”)}
parameter “citconfigfolder” = "{folder “cit” of folder (value of variable “windir” of environment )}"
if {exists file (“cit.ini”) of folder (parameter “citconfigfolder” as string)}
parameter “citconfigdir” = "{key “CIT_ConfigRootDirectory” of file “cit.ini” of folder (parameter “citconfigfolder” as string)& “” & “config”}"
parameter “citproperties” = "{(parameter “citconfigdir” as string) & “” & “Cit.properties”}"
else
parameter “cit_trace_folder” = ""
endif
else
parameter “cit_trace_folder” = ""
endif

// store the file location
parameter “filename” = “{ (parameter “citproperties” as string) }”

// iterate through the file replacing lines as necessary
appendfile {concatenation “%0d%0a” of ( if (it starts with “trace_level=”) then (preceding text of first “trace_level=” of it) & “trace_level=” & “MAX” else it ) of lines of file(parameter “filename”)}

appendfile {concatenation “%0d%0a” of ( if (it starts with “trace_file_size=”) then (preceding text of first “trace_file_size=” of it) & “trace_file_size=” & “2048000” else it ) of lines of file(parameter “filename”)}

appendfile {concatenation “%0d%0a” of ( if (it starts with “trace_file_num=”) then (preceding text of first “trace_file_num=” of it) & “trace_file_num=” & “20” else it ) of lines of file(parameter “filename”)}

// backup the old file (first delete any old backup files)
delete "{parameter “filename”}.bak"
move “{parameter “filename”}” “{parameter “filename”}.bak”
// replace with the new file
move __appendfile “{parameter “filename”}”

It should work; you can certainly use multiple appendfile commands in the same action script. Maybe try createfile until instead.

Thanks Steve, will try that option.