The following is a start until I figure out how to read the desktop count in Mission Control. Right now for this to work you must be on the farthest left Desktop.
Not knowing where your pic is located I'm targeting an image in Desktop Pictures
with:
set thePic to file ((path to library folder from local domain as text) & "Desktop Pictures:Blue Pond.jpg") as text
I set a variable for the count of Mission Control Desktops:
set windowCount to 5
I build a repeat loop starting with the first number till it reaches the count:
repeat with X from 1 to windowCount
end repeat
I use key code to move right with control
only when the count is greater than 1 and a delay:
repeat with X from 1 to windowCount
tell application "Finder"
tell application "System Events"
if X > 1 then
key code 124 using control down ## move right
delay 1
end if
end tell
end tell
end repeat
I then reference every Desktop and add a delay on the picture to be set:
tell application "System Events"
set deskGroup to (a reference to every desktop)
repeat with theDesk in deskGroup
set picture of theDesk to thePic
end repeat
end tell
delay 1
the complete code:
set thePic to file ((path to library folder from local domain as text) & "Desktop Pictures:Blue Pond.jpg") as text
set windowCount to 5
repeat with X from 1 to windowCount
tell application "Finder"
tell application "System Events"
if X > 1 then
key code 124 using control down ## move right
delay 1
end if
set deskGroup to (a reference to every desktop)
repeat with theDesk in deskGroup
set picture of theDesk to thePic
end repeat
end tell
delay 1
end tell
end repeat
this is one way to do this hope it helps. This works and was tested using macOS High Sierra 10.13.6