At this stage in your inquiries I'd strongly recommend not buying
40' cruising yachts have many parts
and systems. At $40k it's likely an old boat so those parts
and systems are most likely old or repaired/upgraded/fixed/etc.
Untill you can make an informed judgement as to whether a boat is suitable for your needs I recommend not buying
, or even getting a survey
Do think carefully about your plans and the education, training and experience that you'll need to follow them.
There is much useful information in this Forum and we welcome your questions.