You’ll have five tax years (2016-2020) over the course of four academic years (2016-2017 through 2019-2020) to take advantage of tax credits.  Normally, the best thing to do is to use the AOTC first for four tax years because it gives the biggest bang for the buck (maxes out at $2,500 credit per year), and then use the LLC for the fifth tax year (20% credit on up to $10k in qualified expenses).
For the first semester (Fall 2016), you’ll want to find $4k in AOTC qualified expenses (tuition, required fees, and required course materials) that haven’t already been covered with tax-advantaged money, which includes tax-free grants.  Looking at the numbers you have provided, and estimating that required course materials will be $500, this number is $2,750 ($19,000 tuition + $500 fees + $500 books - $17,250 university aid).  This means that in order to get the full $4,000 AOTC for the first semester, you will need to declare a portion of the university aid ($1,250) as taxable income to the student and designate it for room and board.  You’ll have to calculate the tax scenarios different ways to see if it makes sense to do this.  Remember, the AOTC is dollar-for-dollar for the first $2,000 in qualified expenses, and $.25 on the dollar for the next $2,000 in qualified expenses.
I’m not sure why the student is taking out loans if you have 529 money to use towards remaining expenses that are 529 qualified (room and board, in this case).  Distributions from 529 accounts must be taken in the same calendar year in which the expenses that they are covering were paid.  This means that you can’t pay for room and board with loans in 2016 and then take a 529 distribution in 2017 to pay those loans off.  If the student has available 529 money, why take out loans?
It will be easier for you to find enough AOTC qualified expenses, after applying university aid, in tax years that cover two academic semesters.  For example, using the figures you have provided: $38,000 tuition + $1,000 fees + $1,000 books - $34,500 university aid = $5,500.  Pay $4,000 of this out-of-pocket and you will be eligible for the full AOTC, and the remaining $1,500, plus all of the room and board ($12,200), can be paid for with 529 money.
You can’t just randomly move money out of a 529, without matching it to qualified expenses paid in the same calendar year, without incurring taxes and likely a 10% penalty on the earnings portion of the distribution.