The racing line depends on the car, how fast it is, how much oversteer it has. It's pretty basic, you need to take the apex (a straight line) cutting through the corner preparing yourself for the next corner, so some corners although you can take them fast you will need to take them slower to be in line.
Also while accelerating out of a corner, make use of all the road to get maximum exit speed like on tight corners eg first corner of Grand Valley, Suzuka's hairpin etc etc make sure that when you accelerate out you are at the opposite edge of the track (as long as there is enough of a straight).
Some corners have double (maybe triple) apexes which are taken the same way, but you need throttle control, maybe some tapping of the brakes depending on how the car is.
Practice with Sport Hard tyres if you aren't already, maybe Comfort Soft if the car is low PP, you will be forced to take a cleaner line and be more careful on accelerator. Actually I would recommend Comfort Soft for practice on any reasonable car as perfect line is the only way, with good braking judgement and throttle control while accelerating out. It will be clear as day on CS tyres when accelerating out as you will either accel out off the track / need to lift off to save yourself, or have too much track left meaning your exit could be quicker.
It's usually better to brake in a straight line and downshift in a straight line on typical corners, but some corners can be taken quicker by tapping the brake while turning, or trail braking, and also downshifting while cornering to get oversteer and exit speed. There are so many types of corner, typical advice is slow in fast out on plain (rightangle-ish corners), straight as you can through chicanes, anything else you sort of have to improvise as you go you can tell if it's fastest or not.
Make sure you have enough practice with downshifting as you need to rev match for the corners, same goes for gear ratios, if your gears are too wide then you will get massive understeer, too narrow and you'll get too much oversteer and will have to upshift through the corner (slow) it's important to tune gears for the track for this reason, nothing worse than coming up to a commonly 2nd gear corner when your 2nd gear is too short and 3rd is too long, you want to be at the start of the power band coming out the apex. Cars with 7 gears are a lot more flexible and forgiving (having more power bands) but not necessarily faster.
If the only problem you're having is hitting _the_ apex rather than _an_ apex then your problem is just not making full use of the road on the exit, in which case try taking corners earlier, start turning even if you think you're gona go off track a lot of the time you wont and you can accelerate out faster to the edge of the track on exit getting more straight line speed (if that makes any sense).
Also don't practice online as other people will take different lines, mess up and put pressure on you, brake at different times etc. When I race online I have to race clean but at the same time pretend they aren't there so they don't badly influence my line
