Compose a musical piece utilizing the given motif as the foundation while maintaining the required musical form.
X:1
L:1/8
M:2/2
K:D
['agf(g e2) dB A (F3 D)(FA)d', 'c)AAf a2 fa bged BeeB efge (3fga'  
X:1
L:1/8
M:2/2
K:D
 agf(g e2) dB | A (F3 D)(FA)d | B (G3 EF)GE | FA (3AAA FAdf | agf(g e2) dB | A (F3 D)(FA)d | 
 B(GF)G E2 ag |1 (3fga e(g f)d d z :|2 (3fga eg fddf |: (3aba fd Adfd | efe(d c)AAf | a2 fa bged | 
 BeeB efge | (3fga f(a gf)ge | fde(c d)BAG | FAdB GBag | (3fga eg fd d2 :|  