I believe the problem is that you need to surround the ini filename in quotes ("). The location of your mIRC means that there is a space (\Program Files\). The writeini interprets that space as meaning you are entering the next argument (the section name). Try this:

writeini $+(",$scriptdir,testfile.ini,") Section2 Variable2 Value2

-genius_at_work