"下个暑假我学了三个月汉语" has two problems.
First, "下个暑假" is next summer, not last. If it's next summer, "了" , as a resultative verb suffix, should not be there, since the action cannot have been completed yet. The correct time is "上个暑假" or better still, "去年夏天". since you never indicated that it's during the summer vacation, so I would simply say "夏天", summer.
Second, "我学了三个月汉语" tells me you learned Chinese for three months. And most people would understand it to be a continuous three months, unless you specify that it's off and on, just like you would in an English sentence. I would add an adverb of manner "斷續" before the verb to indicate it is off and on.
去年夏天我斷續学了三个月汉语。
If you want to add an adverb of place, then it will come before the verb.
去年夏天我在上海斷續学了三个月汉语。