Firstly, yes, it is important to get food and sleep under control. You don't grow muscles in the gym, you grow muscles while recovering from the gym. Recovery is the product of rest and nutrition. You may get a little bit of progress without having these two factors under control, but your progress won't be optimal without sleep or longlasting without food. Thankfully, appetite is an easier thing to adapt to - once you've increased your food intake consistently for a few days, your body just gets used to it and invites more food in, so that's an easier part of the battle to win.
Hey, you're about the same age and size I was when I started. I'm still nothing huge, but I'll tell you when I've had my moments of most rapid muscular development:
1) When I very first started training I gained about 5kg from training, even with bad programs and even worse nutrition to work with.
2) When I was studying Cert III and IV in Fitness, I gained another 7kg over about 6months, because I was learning better nutrition (exercise programming skills were still mediocre).
3) This year, after having finished the full Diploma of Fitness, I went and read up on strength and conditioning, in particular reading and implementing "Starting Strength" by Mark Rippetoe, and in I gained another 5kg in about 6 weeks.
The latter is certainly the most rapid progress I've seen, so I'll use what I was doing during that time as a major point of reference.
1) Learn big, compound exercises. You should read up on them. Starting Strength by Mark Rippetoe is a good book for learning some of the best exercises you can learn, but there are other sources out there. If you can't find someone reliable to teach you the exercises, read up on how to perform them (from a credible author), check the pictures and reliable coaching videos (again, look up videos of Rippetoe on youtube), and take a video of yourself performing the lifts, then post the video on here for critique. LEARN THE EXERCISES - you have nothing to adapt to without a good selection of exercises.
2) Follow a basic program. Again, Starting Strength is a good resource for this, as it has a program with instructions on frequency, sets, reps and progression as part of the book. The program prescribed in the book is, in short:
Day 1 - 3x5 Squats, 3x5 Bench Press, 1x5 Deadlift
Day 2 - 3x5 Squats, 3x5 Overhead Press, 5x3 Power Cleans
There is a lot more information you'd need to know to be doing the porgram correctly, however, which is what the book's there for. I recommend also including Barbell Rows and/or Chin Ups/Pull Ups as assistance work for a couple sets (no warm up sets needed for chins) at the end of each session.
3) Get your nutrition in order. You can't build muscle out of nothing. In my little bulking period earlier this year, I ate 6 weet-bix for breakfast every training day with milk and sugar. Start small and work your way up. During the day I often had peanut butter and jam sandwiches on multigrain bread, or I'd have some sort of meat and salad sandwich. I'd usually have 4 slices of bread, so 2 sandwiches. Again, if you're only comfortable with one sandwich for now, start with that and work up. Dinner was typically meat and 3-veg. Outside of those 3 meals a day, I'd frequently have snacks of fruit or nuts or yoghurt, and I'd drink milk. Lots of it. 2L/day on average. Again, this is something to build up to. Rippetoe recommends 1gallon a day (often referred to here on the interwebz as GOMAD; gallon of milk a day), but when it comes to training and nutrition, overkill isn't necessarily of added benefit. Overall, you'll need to be eating more calories than you're expending. Typically, beginners need about 2,500-3,000kcal to build muscle, and it's generally accepted that of that caloric intake, 1g/lb bodyweight/day should be protein, which, for you means getting 110g or 500kcal protein daily.
4) Do what you can to try and deal with insomnia. It could just be that regular exercise helps your sleep, or that some small adjustments to your sleep habits will improve the situation, or it could be that you need some more specific help from a doctor. I don't know. But if there's anything that can be done to improve the situation, I recommend taking advantage of it, not just for the sake of building muscle but to generally improve your quality of life.
This may not be what you want to hear, but trust me, I spent a lot of time wasting my efforts in the gym getting neither bigger nor stronger nor fitter in any significant way. However, short of the initial gains that were almost inevitable, I have a little bit of experience to help you with. I'm no huge guy, but I've gone from no visible sign of muscles even existing on my body to someone with a much healthier frame. So I hope this helps.