David, the caravan handbrake lever should be fully forward i.e. towards the towball when towing. The clip at the end of the cable should be attached to a ring or loop on the towbar. If there is no such ring, then it is permissable to run the cable round the towball and clip it back onto itself, although this is not the preferred way. There should still be sufficient slack in the cable to allow for turning movement between car and caravan.
The purpose of this cable - "breakway cable" is to apply the caravan brakes should the caravan become unhitched while travelling. It will pull the bottom of the handbrake forward, moving the top towards the upright and should then itself break or snap so the car can be stopped safely.
Unhitching like this is not very common - fortunately - and is usually casued by a worn (and thus small) towball and or a worn and thus large hitch body. Another cause is failure to engage the hitch and ball correctly. Most modern hitches have a button in the hitch body which rises to show a green band when the hitch and ball are correctly engaged. If yours has one of these check it every time you hitch up and when you stop.
If you have any doubt about the state of your hitch or towball please get it checked as soon as you can.