Change the current iTunes song's rating after it finishes playing?
with timeout of 600 seconds
    tell application "iTunes"
        set cur to current track
        repeat until current track is not cur
            delay 1
        end repeat
        set rating of cur to 40 -- 2 stars
    end tell
end timeout


This would select the next track and set the rating of the previous track to two stars:

tell application "iTunes"
    set cur to current track
    next track
    set rating of cur to 40
end tell