iPhone 4 GSM 3,1 upgrade
Unfortunately you can't upgrade to another version other than the latest iOS version, as your iPhone requires to have the software verified with the apple servers to sign it.

There use to be a fix to this by blocking the connection of iTunes with Apple server or diverting it to a custom server but this can't be done anymore.

So your best bet is to continue using iOS 5.1.1 or upgrade to 7.1.1