try using $replace You also have too many parantheses in your code. Here's a re-write with all of the changes, and making it one line. If you need the variables for use elsewhere in the script, then use the second code.
That won't help. The issue is that INI files *need* to have = signs after the item name and that is what the OP doesn't want. Instead, it would be easier to use a text file instead of an ini file. You can still create categories in it if you want to, but it won't require the = signs. Or, you can include item names when using writeini. You can use $ini to get the number of items in the group and then make the item name 1 greater, so that each item name is a number. Just a thought.