When using the gsmctl -U command only the first line of the response is stored in the /tmp/ussd file.
gsmctl -U "*335#"
cat /tmp/ussd
2019-11-15 17:40:18 1,"Welcome To MTN Data Bundles
the following lines contain the menu. Complete responses usually have ending " and ,15 i.e.
2019-11-15 17:41:12 0,"MTNDataBundles",15
I was looking for the source of the command , but all I could find in the SDK was the binary.