Craft a musical piece that incorporates the given motif and follows the outlined structure.
X:1
L:1/8
M:3/4
K:G
['A>a g>a g>a'  
X:1
L:1/8
M:3/4
K:G
 b>a g>f g>f | e>d c>B c2 | D>F A>c B>A |1 G>A B>c d2 :|2 G2 G4 |:[K:D] A>a g>a g>a | A>a g>a g>a | 
 A>^c e>g f>e |1 d>e f>g a2 :|2 d2 d4 |]  