Are you putting the script in an Execute an AppleScript action?
IAC, when you are trying to manipulate windows in AppleScript, you generally need to use "System Events" and the frontmost process. This revised script works for me:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set myApplication to name of current application
set screenWidth to 2560 --1920
set screenHeight to 1440
tell application "System Events"
set frontProcess to first process whose frontmost is true
tell frontProcess
if (count of windows) ≤ 2 then
set myWidth to screenWidth / 2
tell window 1
set position to {0, 0}
set size to {myWidth, screenHeight}
end tell
tell window 2
set position to {myWidth, 0}
set size to {myWidth * 2, screenHeight}
end tell
end if
end tell
end tell
BTW, when posting a script, please put it in a Code Block.
See WINDOWCOUNT function.