>I need to use POSIX due to this is supposed to be a generic script, and the files are located in the users folder.
Completely sure I don't understand this statement. You're using Finder references, so there's no value in POSIX paths. POSIX paths should be used when using shell commands.
In any case, this is broken in many ways:
> set name of document "preference_TEST.xml" to (POSIX path of (path to home folder)) & "Library/Preferences/MPP/Local Store/preferences.xml" as POSIX file
Consider what you're asking the Finder to do.
First off you have some vague reference to 'document "preference_TEST.xml"' without giving the Finder a hint as to where to find this document. In addition, the Finder doesn't really have 'documents' of its own, so this will fail on that reference alone. Instead you should use 'file' or 'document file' instead (intrinsically, 'documents' are owned by specific applications, but in this case the Finder doesn't own any of these files, it just manipulates them).
Then (assuming the Finder can actually find this file), you're trying build the path to a some other presences file. In your example:
> POSIX path of (path to home folder)) & "Library/Preferences/MPP/Local Store/preferences.xml"
would translate into something like:
/Users/username/Library/Preferences/MPP/Local Store/preferences.xml
which you then try to coerce to a POSIX file (hint: you can't change a filename into a POSIX file)
In either case, even dropping the POSIX file faux pas, this script would try to change the FILENAME of the file to that full path - this DOES NOT move the file in any way, just changes its name. So assuming the original preferences_TEST.xml file was, say, on your desktop, this would rename:
~/Desktop/preferences_TEST.xml
to:
~/Desktop/\/Users\/username\/Library\/Preferences\/MPP\/Local\ Store\/preferences.xml
which I'm 99.9% sure isn't what you want - renaming a file doesn't move it - it leaves it where it is and just changes its name.
Reading between the lines, you want your script to take a specific preferences_TEST.xml file and move it into the appropriate users Preferences folder, replacing any existing file, is that correct? Do you want/need to retain the original _TEST.xml file? or not.
Assuming not, your script should look something more like:
set dT to (path to desktop) -- this returns the current user's desktop path
set dP to (path to preferences) -- this returns the current user's preferences folder
tell application "Finder"
-- find the source file
set prefsFile to file "preferences_TEST.xml" of dT
-- rename it
set name of prefsFile to "preferences.xml"
-- and move it into place. Use 'duplicate' instead of 'move' to leave the source file in place
move prefsFile to folder "Local Store" of folder "MPP" of dP with replacing
end tell