Here an example of my "Dev1" setting with three displays (two 27" external 4K displays and one 14" MacBook). Move Firefox to the first display and leave 50 pixel space for the left side dock. Move IntelliJ IDEA to the second and iTerm2 to the MacBook screen. Works reliable.
use application "System Events"
get (every window of process "firefox" whose value of attribute "AXMinimized" is false)
repeat with W in the result
set position of W to {50, 0}
set size of W to {1870, 1080}
end repeat
get (every window of process "idea" whose value of attribute "AXMinimized" is false)
repeat with W in the result
set position of W to {1920, 0}
set size of W to {1920, 1080}
end repeat
get (every window of process "iTerm2" whose value of attribute "AXMinimized" is false)
repeat with W in the result
set position of W to {1125, 1100}
set size of W to {1510, 940}
end repeat