Decide on what type of song you want to write. This determines how you should set up your amplifier, and how you should approach the songwriting process as a whole. If you want to write blues, you should go lightly on the distortion and possibly take a more jam-based approach to the songwriting process. Punk songs, on the other hand, need to have the distortion turned up, and a more energetic approach to songwriting.
Adjust your amp settings until you get a sound you like. Fiddling around with different effects and levels can bring new sounds out of your axe, and inspire you to make a new tune to suit it. If you need an idea of the sort of settings you need for different sounds, there are many websites online dedicated to guitar tone that can give you some ideas.
Start with a riff, melody or chord progression. As you sit down to write your song, the first thing you need is something to build on. Many rock and metal songs will include a riff, which is generally prominent in the introduction, and then returns in the chorus or later in the song to tie the whole thing together. Look at "Enter Sandman" by Metallica for a well-known and well-executed example. The entire introduction builds up to that one riff. If you have trouble inventing something off the top of your head, learn a few scales (the minor pentatonic is a rock favorite) and experiment with the notes from that.
Write a simple chord progression if you can't come up with a catchy riff. Power chords make up a large percentage of rock songs, and they can be played virtually anywhere on the thickest four strings. Take a basic C power chord, which is the third fret on the A string (the root) and the fifth fret on both the D and G strings. This shape can be moved up and down the guitar to change the chord. You can also use the same shape but with any fret on the E string as the root note. For example, you could fret the third fret on the E string and the fifth fret on the A and D strings to play a G power chord.
Structure the song around your riff or chord progression. A generic song structure would be first the introduction, which could be comprised of a couple of loops of your riff or a run-through of your chord progression, and then a verse. The verse can just be a simplified version of the chord progression or riff, or a palm-muted repetition. Gently rest your palm on the strings near the bridge as you play to produce a palm-muted note. After the verse, move to a chorus, which could be a repetition of the original riff or something different. Then play the verse part a second time, play a second chorus, and then you can have an instrumental, middle section if you like. Finish the song off with a chorus.
Work on the basic skeleton of your song over time. Your new song will be in a bare bones state, with the chord changes and riffs in place, but perhaps not completely perfect. Even though it doesn't seem like it, the song will grow as you get used to playing it; you add little touches and fills as time goes on.