Do you need an iPhone to build iPhone apps?
Strictly speaking, no, you do not need to have an iPhone in order to build iPhone apps. The iOS Simulator does a pretty good job and allows you to test how your app is likely to work on a range of iPhone models (or other devices).

However, having some physical devices you can install your apps on is certainly an advantage. In my own app development there have been a number of times that I've identified that something just hasn't looked quite right on an iPod, iPhone or iPad (whereas in the Simulator it looked fine). And, I've also had instances where something didn't quite look/work right in the Simulator, but it was fine on a physical device.

Only you can decide whether keeping your iPhone is worth more to you than selling it.