Avoid machines, they set you up for future injuries, you need to to teach yourself proper movement patterns that are essential to humans - Squat, Deadlift, Bent over rows, Bench-press and then gradually start adding more isolation exercises. Start on a strength based program such as a 5x5 one (you can find one easily on the internet) - DONT EGO LIFT! Do dynamic warmups before training and static stretching after. Try to eat clean protein and not protein shakes as they are extremely processed, PM me if you need any tips. I'd recommend watching a few videos on how to do exercises properly so you don't get into bad habits. If you can't gain weight eat more, eat alot of carbohydrate dense foods - Rice, vegetables - make sure you get your essential nutrients, it's not as easy as just going to the gym, it takes hardwork and dedication.