Raymond Murphy says to use the preposition "to" after the verb "write" (write a letter to somebody), but the famous song contains following words:
I'm gonna sit right down and write myself a letter.
How can you explain that? Thank you in advance.
"to write" is used here as a transitive verb and "a transitive verb can also have an indirect object, which is a noun, pronoun, or noun phrase that comes before a direct object and indicates the person or thing that receives what is being given or done. Many common verbs can be used with both direct and indirect objects." [Source]
*The indirect object in Italics and the direct object in Bold
Ditransitive verbs (i.e verbs that can take two objects) have two patterns : Prepositional pattern and dative-movement pattern.
Okay let me explain
Prepositional pattern is when the direct object follows the verb and the indirect object is moved into a prepositional phrase (that is usually preceded by for or to). For example,
Dative-movement pattern is when the verb is followed by an indirect object and direct object consecutively.