Good advice, Lily. I am sure w lot of freelancers get caught by this when first starting out. I refuse to write an unpaid article as a sample. Like you, I will give them links to other articles I have written online, or I have files made up called samples..that have a few paragraphs from a number of other projects I have written, that I will send.
There are always people who try to get work for nothing. Other clients who may refuse to pay saying the work you delivered wasn’t what they expected etc. and no amount of edits will please them. That is a tough one…sometimes you just have to bite the bullet and mark that off as experience gained, and hopefully use the item elsewhere.