This should work for you. Also you don't need to define any variable, n.times should run the block n times. Hope that helps!
def "create 9 more names"(){
def i = 0
8.times{
$("button", value:"newCat").click()
waitFor { $("input", name:"name") }
$("input", name:"name") << "gebTest"
$("input", name:"create").click()
waitFor { $("h1", text:"Show New Name") }
$("a", text:"new name").click()
waitFor {$("h1.title").text() == "Names"}
expect: at NewNamesPage
i += 1
}
}