It's usually a waste of time to write first and query second. If you spend your time writing articles no one wants, you spend your time not getting paid. Even as a brand new writer, editors will still ask to see a promising article. They'll ask for it on spec, but this still means you don't have to write it until an editor is interested.
Time is best spent developing queries, lining up possible interviews, etc., not writing articles no one wants.
A second reason not to write in advance is an editor may not want an article written the way you conceived it. He'll often have his own ideas about content and slant, which means you'll have to start all over on an article you've already written once.
There are times and places where writing the article first is the rule, but not for magazines that ask for queries.