MJ...
You're storing names to the Global NamesList. That's just names... no genders... so your search would always come up empty.
So, once you get the name, you have to get the entire record from the TinyDB, and store it to a LIST... then your list.gender field needs to be checked. Then you go on to the next record. Instead of testing each item in the record by extracting the list value again from the TinyDB, extract it once, check the values, then go on to the next TinyDB record, store it to the list, check the list...