To get email id that does not exist, you should have all the already existing ids in a database.
Then you look for the different combination firstlast, lastfirst, firstfirst, ...
And each time you find a matching id in your database, you create a counter a try one more time with this counter value (ex. firstlast1, then firstlast2, ...)
Or do avoid a lot of requests to the database, if you know SQL syntax, you can do a search like:
SELECT knownid FROM KnownIDTable WHERE knownid LIKE 'firstlast%'
and then analyze the rows to get the unique value for your counter.