So, you do want to make a string from list? That's simple, you can use str.join to do this:
ips = ['1.2.3.5','1.2.3.4']
# this is list comprehension, it does the same thing as your loop
y = ["model.data.like('%"+ip+"%')" for ip in ips]
print ','.join(y)