I might be wrong here, but I think the issue is user error. Which is why [hackers] stress learning to code so much. This seems, to me at least, a very script kiddy question. "Help me brute force an email account", "I tried this thing I found online and it aint working..."
This could be handled in Python, and I'll give pseudo code in a sec, but this seems like some kind of copypasta from a tut that isn't working for OP.
Anyway, if you would code this simple shit yourself here is how it could go:
load libs you need
load the wordlist your using
for idshit in wordlist
if login_with(idshit) is true
do malisouse shit
else
go to next creds in wordlist bro
if IcantLoginBro
useCodeIWroteWith(libsINeed) //to gen more bruteforceshit
else
GO READ A FUCKING BOOK