Creating a project from a task would ideally work by just creating a new project "with properties {root task:MyTask}", but this isn't specifically implemented -- it might work, but there would be a root task that would probably get orphaned and then resurrected into the Inbox ... not good. I've logged <bug://bugs/43714> ('make new project' should accept a 'root task' in its properties) on this.
Assigning a task to an inbox item would just involve setting the 'assigned container' (can either use a project, its root task or any other task). With an existing task, you should just 'move' it where you want it (TN2106 says container properties should generally be read-only and 'move' should be used to update them).
Here are some examples:
Code:
tell application "OmniFocus"
tell default document
set MyProject1 to make new project with properties {name:"Test project 1"}
tell MyProject1
set MyAction to make new task with properties {name:"action"}
end tell
set MyProject2 to make new project with properties {name:"Test project 2"}
move MyAction to end of tasks of MyProject2
set MyProject3 to make new project with properties {name:"Test project 3"}
duplicate MyAction to end of tasks of MyProject3 with properties {note:"I'm in 3 now!"}
set MyInboxItem to make new inbox task with properties {name:"Stuffs"}
set assigned container of MyInboxItem to MyProject1
end tell
end tell