2 answers

1

Actually, the first sentence is not entirely correct. Here is the original:

We need not only food, but also shelter.

The part that is correct is the paired conjunction 'not only...but also'. The part that is incorrect is the use of the comma before the coordinating conjunction 'but'. Only use a comma when the coordinating conjunction is followed by an independent clause - in other words, a group of words with a subject and predicate that can stand alone as a complete and meaningful sentence. In the example that was given, the coordinating conjunction only connects two nouns. In this case, the comma is not needed. In fact, it is incorrect. The change of word order for the same sentence is unnecessary, but correct.

Here are my ideas about your other two sentences.

We play the guitar as well as the violin.

The focus here is on using parallel structures when you use the connecting words 'as well as'. This means that you have to use the same structure before and after the connecting words. Here, you have the structure definite article + noun before 'as well as', so you have to use the same structure afterward, which is in fact exactly what you are doing. It is not necessary to repeat the verb 'play' in this structure since you are creating parallel structures of the compound object [the guitar...the violin] of this verb.

We play the guitar as well as compose music.

Here, the structure before the connecting words 'as well as' is verb + article + noun [article + noun = object in this case], and you have exactly the same structure after the connecting words. In this sentence, the verbs are different [this means you don't have a compound object], and hence you need to repeat the verb in each of the before and after structures.