Wanjiru, sorry to hear that. « Purpose of visit » usually means the officer didnt believe the program matches your background. What did you study before, and what diploma did you pick? If theres no logical link, they refuse. A strong SOP explaining the link is key for the 3rd try.
Kwame, 3 months for Accra is actually normal, dont panic. My friend waited 4 months for a visit visa from Lagos and got approved in the end. West Africa VOs are just slow. Send a webform after 3 months though, it doesnt hurt.