Answered in the other thread and it's probably best to continue this over there.
But, for completeness:
This is not how you concatenate strings in AS -- you use the & symbol. So if you want to add ".pages" to the of myVar it would be
set myVar to (myVar & ".pages")
But using the ~ symbol for "starting at my home directory" doesn't work in AS. The easiest way round that is to "Filter: Standardize" your path in KM to give an absolute POSIX path -- and you might as well add ".pages" to the KM string before you do that then pass the complete absolute POSIX path to your AS.