Gradient Descend Method
The equations are not showing quite what you think. For the equations you have copied, when you see $\mathbf{x}^{(i)}$, you should not think of it as 


  The ith feature of an example record $\mathbf{x}$ - [INCORRECT]


Instead it is 


  The ith example record from the training dataset - [CORRECT]


So, $\mathbf{x}^{(i)}$ in this case is actually a vector including all features of a single example, and the equations show vector arithmetic. The parameter $\theta$ is also a vector. 

The individual feature indexing is shown with a subscript $j$ i.e. $x^{(i)}_j$ is the jth feature of the ith record. The equations are also using bold $\mathbf{x}$ for a vector quantity and non-bold $x$ for a scalar quantity to try and make it clearer.

Take care, when you have multiple dimensions of data to work through, different document sources will use different conventions and indexing schemes. After a while, when you know what to expect is going on, you will spot the differences quickly and figure out which convention is in use. This is only a minor problem, and can crop up if you switch learning sources - e.g. watch a video lecture by one researcher then read a book by another.


  Lets suppose we have n sized input data (x1,x2,...,xn) , each input data has m attributes. 


There are $m$ examples in the dataset. The data is $(\mathbf{x}^{(1)}, \mathbf{x}^{(2)},...,\mathbf{x}^{(m)})$

There are not $m$ components of each vector. It is not stated how many components there are in the equations.


  In the cost fucntion we basically have an xi from (x1,x2,...,xn), but which one? We just take one at random? And that remains standard throughout the algorithm? 


Both equations sum over the whole dataset to calculate cost function or its gradient.