Your internal ranking + external HSC marks is calculated together to get your ATAR. Other factors include school rank, cohort size, marks of cohort etc.
Your external mark depends on the mark you get in the hsc exam.
Your internal mark depends on your internal rank, your cohort's highest external mark, lowest external mark, and average external mark.
Your HSC mark is the average of those two.