The more familiar you are with a scale, the easier you will find it to play melodies created from that scale, and the easier you will be able to create your own melodies from the scale. One of the best ways to practice scales is through the use of sequences.
A sequence is a repetitive pattern in which the rhythm remains the same while the pitches are repeated higher or lower, usually within a specific scale or key. Practicing sequences is also good for you co-ordination and bowing technique. Here are some sequences within the D major scale.
This piece in the key of D major also features the use of sequences. Take it slowly until you can play it easily and then gradually increase the tempo.