Hi there!
We can begin by calculating the acceleration of the system:
∑F = ma
m = sum of the mass of both blocks
Solve for acceleration:
∑F/m = a
30/(6 + 9) = 2 m/s²
On the 6 kg block, the tension is equivalent to the net force:
∑F = T
Since we know that the 6kg is accelerating at 2 m/s², we can solve for tension:
∑F = T = ma
T = 6 · 2 = 12 N