Well, it's fairly obvious. Bad argument means you're passing something you shouldn't be.
So, the values you're passing and getting errors on are all returned from other functions. I can't tell exactly what the issue is, but why not output some of the intermediate values - see what getPlayerFromNick returns for example - does it return nil or false? Do the same with your playerlicensedata variable.
Most likely, the playername you're specifying doesn't exist, causing getPlayerFromNick to return nil (or false). That's then passed to getClientAccount thats returning nil, causing getAccountName to give an error.
Presumably the xml error on line 8 is because you don't have a node called 'license' inside your 'playerlicense' node of your xml file.